The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
fix: prevent unnecessary dialog after saving a new edge function (#43854)
Gildas Garcia9dd19f1da578
diff --git a/apps/studio/pages/project/[ref]/functions/new.tsx b/apps/studio/pages/project/[ref]/functions/new.tsxindex 42d0b7bd125..0897ffd42a0 100644--- a/apps/studio/pages/project/[ref]/functions/new.tsx+++ b/apps/studio/pages/project/[ref]/functions/new.tsx@@ -143,14 +143,22 @@ const NewFunctionPage = () => {},})- const { mutate: deployFunction, isPending: isDeploying } = useEdgeFunctionDeployMutation({+ const {+ mutate: deployFunction,+ isPending: isDeploying,+ isSuccess: hasDeployed,+ } = useEdgeFunctionDeployMutation({// [Joshen] To investigate: For some reason, the invalidation for list of edge functions isn't triggeringonSuccess: () => {toast.success('Successfully deployed edge function')const functionName = form.getValues('functionName')- if (ref && functionName) {- router.push(`/project/${ref}/functions/${functionName}/details`)- }+ // Allow the mutation state (isSuccess) to propagate before navigating+ // to prevent unnecessary dialog about unsaved changes+ setTimeout(() => {+ if (ref && functionName) {+ router.push(`/project/${ref}/functions/${functionName}/details`)+ }+ }, 150)},})@@ -415,7 +423,7 @@ const NewFunctionPage = () => {</Button></form></Form_Shadcn_>- <PreventNavigationOnUnsavedChanges hasChanges={hasUnsavedChanges} />+ <PreventNavigationOnUnsavedChanges hasChanges={hasUnsavedChanges && !hasDeployed} /></PageLayout>)}