Skip to content

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

updated side panel editor to update column with new name change (#40530)

Ali Waseemdd05ebf88eb2
diff --git a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.utils.tsx b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.utils.tsx
index f6fb7aa0e9a..9fb9ab70ea7 100644
--- a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.utils.tsx
+++ b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.utils.tsx
@@ -13,6 +13,7 @@ import { FOREIGN_KEY_CASCADE_ACTION } from 'data/database/database-query-constan
import { ForeignKeyConstraint } from 'data/database/foreign-key-constraints-query'
import { databaseKeys } from 'data/database/keys'
import { entityTypeKeys } from 'data/entity-types/keys'
+import { lintKeys } from 'data/lint/keys'
import { prefetchEditorTablePage } from 'data/prefetchers/project.$ref.editor.$id'
import { getQueryClient } from 'data/query-client'
import { executeSql } from 'data/sql/execute-sql-query'
@@ -832,7 +833,12 @@ export const updateTable = async ({
const res = await updateColumn({
projectRef: projectRef,
connectionString: connectionString,
- originalColumn: originalColumn,
+ // Use the updated table name and schema since the table might have been renamed
+ originalColumn: {
+ ...originalColumn,
+ table: updatedTable.name,
+ schema: updatedTable.schema,
+ },
payload: columnPayload,
selectedTable: updatedTable,
skipPKCreation: true,
@@ -875,6 +881,7 @@ export const updateTable = async ({
queryClient.invalidateQueries({ queryKey: databaseKeys.tableDefinition(projectRef, table.id) }),
queryClient.invalidateQueries({ queryKey: entityTypeKeys.list(projectRef) }),
queryClient.invalidateQueries({ queryKey: tableKeys.list(projectRef, table.schema, true) }),
+ queryClient.invalidateQueries({ queryKey: lintKeys.lint(projectRef) }),
])
// We need to invalidate tableRowsAndCount after tableEditor