Skip to content

Commit e557ec6

Browse files
authored
Chore/fix cron job create (supabase#37617)
* Fix cron job create * Fix
1 parent efaf4d5 commit e557ec6

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

apps/studio/components/interfaces/Integrations/CronJobs/CreateCronJobSheet.tsx

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -305,18 +305,20 @@ export const CreateCronJobSheet = ({
305305
const onSubmit: SubmitHandler<CreateCronJobForm> = async ({ name, schedule, values }) => {
306306
if (!project) return console.error('Project is required')
307307

308-
const checkExistingJob = await getDatabaseCronJob({
309-
projectRef: project.ref,
310-
connectionString: project.connectionString,
311-
name,
312-
})
313-
const nameExists = !!checkExistingJob
314-
315-
if (nameExists) {
316-
return form.setError('name', {
317-
type: 'manual',
318-
message: 'A cron job with this name already exists',
308+
if (!isEditing) {
309+
const checkExistingJob = await getDatabaseCronJob({
310+
projectRef: project.ref,
311+
connectionString: project.connectionString,
312+
name,
319313
})
314+
const nameExists = !!checkExistingJob
315+
316+
if (nameExists) {
317+
return form.setError('name', {
318+
type: 'manual',
319+
message: 'A cron job with this name already exists',
320+
})
321+
}
320322
}
321323

322324
const command = `$$${values.snippet}$$`

0 commit comments

Comments
 (0)