Skip to content

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

Fix running queyr cell marks notebook tab with unsaved change indicator (#49464)

Joshen Limf1526d2d1b43
diff --git a/apps/studio/components/interfaces/Explorer/QueryCell/index.tsx b/apps/studio/components/interfaces/Explorer/QueryCell/index.tsx
index ae7a7159344..8f2183c1a55 100644
--- a/apps/studio/components/interfaces/Explorer/QueryCell/index.tsx
+++ b/apps/studio/components/interfaces/Explorer/QueryCell/index.tsx
@@ -81,8 +81,13 @@ export const QueryCell = forwardRef<QueryEditorHandle, QueryCellProps>(function
updateQueryCell((candidate) => ({ ...cloneQueryCell(candidate), title: nextTitle }))
}
- const handleSqlCommit = (value: string) =>
+ // Running a cell re-commits its current SQL (see QueryEditor's handleRunQuery) even when
+ // nothing changed — skip the store write so that doesn't spuriously mark the notebook
+ // unsaved.
+ const handleSqlCommit = (value: string) => {
+ if (value === cell.unchecked_sql) return
updateQueryCell((candidate) => setCellSql(candidate, value))
+ }
const handleDisplayChange = (display: QueryDisplay) =>
updateQueryCell((candidate) => ({