Skip to content

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

fix: snippet content missing after move or rename (#47409)

Charisb34a9a027f61
diff --git a/apps/studio/data/content/content-upsert-mutation.ts b/apps/studio/data/content/content-upsert-mutation.ts
index 1065c154212..26640dbb066 100644
--- a/apps/studio/data/content/content-upsert-mutation.ts
+++ b/apps/studio/data/content/content-upsert-mutation.ts
@@ -2,7 +2,7 @@ import { useMutation, useQueryClient } from '@tanstack/react-query'
import { toast } from 'sonner'
import type { Content } from './content-query'
-import { unmapSqlContentField } from './content-remap'
+import { remapSqlContentField, unmapSqlContentField } from './content-remap'
import { contentKeys } from './keys'
import type { Snippet, SnippetWithContent } from './sql-folders-query'
import type { components } from '@/data/api'
@@ -33,9 +33,7 @@ export async function upsertContent(
if (error) handleError(error)
const snippet = data as Snippet | null
- // The upsert response is a snippet freshly persisted to the database, so it
- // carries status 'saved' as it crosses into the app — same as the queries.
- return snippet === null ? null : { ...snippet, status: 'saved' }
+ return snippet === null ? null : { ...remapSqlContentField(snippet), status: 'saved' }
}
export type UpsertContentData = Awaited<ReturnType<typeof upsertContent>>