Skip to content

Commit 62c86c5

Browse files
fix(tables): match column id or name when removing column from optimistic delete cache
1 parent 4dbcbcf commit 62c86c5

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

apps/sim/hooks/queries/tables.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1376,8 +1376,10 @@ export function useDeleteColumn({ workspaceId, tableId }: RowMutationContext) {
13761376
const lower = columnName.toLowerCase()
13771377
const previousDetail = queryClient.getQueryData<TableDefinition>(tableKeys.detail(tableId))
13781378
if (previousDetail) {
1379+
// The grid deletes by stable id; legacy callers may pass a name. Match
1380+
// on either so the column is dropped from the optimistic schema cache.
13791381
const nextColumns = previousDetail.schema.columns.filter(
1380-
(c) => c.name.toLowerCase() !== lower
1382+
(c) => getColumnId(c) !== columnName && c.name.toLowerCase() !== lower
13811383
)
13821384
const prevWidths = previousDetail.metadata?.columnWidths
13831385
const nextMetadata = prevWidths

0 commit comments

Comments
 (0)