Skip to content

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

Fix error handling for table side panel editor (#34691)

Joshen Lim21cd562f4092
diff --git a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.tsx b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.tsx
index 7ae60181d6b..36b79a4d6e5 100644
--- a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.tsx
+++ b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.tsx
@@ -482,7 +482,9 @@ const SidePanelEditor = ({
}
if (hasError) {
- toast(`Table ${table.name} has been updated, but there were some errors`, { id: toastId })
+ toast.warning(
+ `Table ${table.name} has been updated but there were some errors. Please check these errors separately.`
+ )
} else {
if (isTableEditorTabsEnabled && ref && payload.name) {
// [Joshen] Only table entities can be updated via the dashboard
diff --git a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.utils.tsx b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.utils.tsx
index 85642d798a7..5b9799e38ea 100644
--- a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.utils.tsx
+++ b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.utils.tsx
@@ -275,6 +275,7 @@ export const createColumn = async ({
if (!skipSuccessMessage) {
toast.success(`Successfully created column "${column.name}"`, { id: toastId })
}
+ return { error: undefined }
} catch (error: any) {
toast.error(`An error occurred while creating the column "${payload.name}"`, { id: toastId })
return { error }
@@ -702,7 +703,7 @@ export const updateTable = async ({
...column,
isPrimaryKey: false,
})
- await createColumn({
+ const { error } = await createColumn({
projectRef: projectRef,
connectionString: connectionString,
payload: columnPayload,
@@ -710,6 +711,7 @@ export const updateTable = async ({
skipSuccessMessage: true,
toastId,
})
+ if (!!error) hasError = true
} else {
const originalColumn = find(originalColumns, { id: column.id })
if (originalColumn) {