Skip to content

Commit a0afa9e

Browse files
authored
fix(table editor): request fired per column when updating table (supabase#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.
1 parent 5a0e1cb commit a0afa9e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/ColumnEditor.utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export const generateColumnFieldFromPostgresColumn = (
7070
table: column.table,
7171
schema: column.schema,
7272
name: column.name,
73-
comment: column?.comment ?? '',
73+
comment: column?.comment,
7474
format: isArray ? column.format.slice(1) : column.format,
7575
defaultValue: column?.default_value as string | null,
7676
check: column.check,

apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export interface ColumnField {
4646
table: string
4747
schema: string
4848
check: string | null
49-
comment?: string
49+
comment?: string | null
5050
format: string
5151
defaultValue: string | null
5252
foreignKey?: ExtendedPostgresRelationship

0 commit comments

Comments
 (0)