From a0afa9eef2885bb730e82b72e55bec5b52c35961 Mon Sep 17 00:00:00 2001 From: Charis <26616127+charislam@users.noreply.github.com> Date: Wed, 5 Nov 2025 06:57:49 -0500 Subject: [PATCH] fix(table editor): request fired per column when updating table (#40160) When updating a table with many columns, a request is fired per column, causing potential rate-limiting. The biggest contributor is a bug in the `comment` config of each column. If columns have no comment, we coerce the comment to an empty string, but our column payload diff function sees this as a difference, thus tries to set a new comment on every column. Unfortunately this is not a one-time issue, because Postgres considers an empty comment to be null, and corces it back to null, and on and on we go in a giant circle. The fix is just to not coerce to empty strings on our end. There are a few other requests that we might be able to shave, but this is by far the noisiest one. --- .../SidePanelEditor/ColumnEditor/ColumnEditor.utils.ts | 2 +- .../TableGridEditor/SidePanelEditor/SidePanelEditor.types.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/ColumnEditor.utils.ts b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/ColumnEditor.utils.ts index 896f97e8ed5..b19bada0766 100644 --- a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/ColumnEditor.utils.ts +++ b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/ColumnEditor.utils.ts @@ -70,7 +70,7 @@ export const generateColumnFieldFromPostgresColumn = ( table: column.table, schema: column.schema, name: column.name, - comment: column?.comment ?? '', + comment: column?.comment, format: isArray ? column.format.slice(1) : column.format, defaultValue: column?.default_value as string | null, check: column.check, diff --git a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.types.ts b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.types.ts index 508e0be22f1..a497e2c3c75 100644 --- a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.types.ts +++ b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.types.ts @@ -46,7 +46,7 @@ export interface ColumnField { table: string schema: string check: string | null - comment?: string + comment?: string | null format: string defaultValue: string | null foreignKey?: ExtendedPostgresRelationship