Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Chore/fix cron job create (#37617)

Joshen Lime557ec66c8c3
diff --git a/apps/studio/components/interfaces/Integrations/CronJobs/CreateCronJobSheet.tsx b/apps/studio/components/interfaces/Integrations/CronJobs/CreateCronJobSheet.tsx
index 41826b45574..547aa46879a 100644
--- a/apps/studio/components/interfaces/Integrations/CronJobs/CreateCronJobSheet.tsx
+++ b/apps/studio/components/interfaces/Integrations/CronJobs/CreateCronJobSheet.tsx
@@ -305,18 +305,20 @@ export const CreateCronJobSheet = ({
const onSubmit: SubmitHandler<CreateCronJobForm> = async ({ name, schedule, values }) => {
if (!project) return console.error('Project is required')
- const checkExistingJob = await getDatabaseCronJob({
- projectRef: project.ref,
- connectionString: project.connectionString,
- name,
- })
- const nameExists = !!checkExistingJob
-
- if (nameExists) {
- return form.setError('name', {
- type: 'manual',
- message: 'A cron job with this name already exists',
+ if (!isEditing) {
+ const checkExistingJob = await getDatabaseCronJob({
+ projectRef: project.ref,
+ connectionString: project.connectionString,
+ name,
})
+ const nameExists = !!checkExistingJob
+
+ if (nameExists) {
+ return form.setError('name', {
+ type: 'manual',
+ message: 'A cron job with this name already exists',
+ })
+ }
}
const command = `$$${values.snippet}$$`