The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Fix saving snippet outisde of sql editor + fix deleting snippet not rendering next one properly
Joshen Lim40ab79e5b591
diff --git a/studio/components/layouts/SQLEditorLayout/QueryItem.tsx b/studio/components/layouts/SQLEditorLayout/QueryItem.tsxindex 7472e6ab7eb..7571d5f2c9b 100644--- a/studio/components/layouts/SQLEditorLayout/QueryItem.tsx+++ b/studio/components/layouts/SQLEditorLayout/QueryItem.tsx@@ -85,7 +85,7 @@ const QueryItemActions = observer(({ tabInfo }: { tabInfo: SqlSnippet }) => {try {await deleteContent({ projectRef: ref, id })- const existingSnippetIds = Object.keys(snap.snippets)+ const existingSnippetIds = Object.keys(snap.snippets).filter((x) => x !== id)if (existingSnippetIds.length === 0) {router.push(`/project/${ref}/sql`)} else {diff --git a/studio/state/sql-editor.ts b/studio/state/sql-editor.tsindex c7cc46f9aa9..4ce5d62fed8 100644--- a/studio/state/sql-editor.ts+++ b/studio/state/sql-editor.ts@@ -68,7 +68,10 @@ export const sqlEditorState = proxy({}sqlEditorState.results[snippet.id] = []sqlEditorState.savingStates[snippet.id] = 'IDLE'- if (!sqlEditorState.orders[projectRef].includes(snippet.id)) {+ if (+ sqlEditorState.orders[projectRef] !== undefined &&+ !sqlEditorState.orders[projectRef].includes(snippet.id)+ ) {sqlEditorState.orders[projectRef].unshift(snippet.id)}if (isNew) {