Skip to content

Commit d8c279b

Browse files
fix(tables): send only the layout keys an action changes
Pin, reorder, and insert-column each shipped a full columnWidths snapshot they never modified. Both sinks merge at top-level key granularity, so an earlier-issued patch landing after a concurrent resize replaced the newer width map with its stale copy. Resize, auto-resize, and delete-column still send columnWidths — those genuinely change it.
1 parent c584cde commit d8c279b

1 file changed

Lines changed: 5 additions & 9 deletions

File tree

  • apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table-grid

apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table-grid/table-grid.tsx

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -712,10 +712,12 @@ export function TableGrid({
712712
setColumnOrder(newOrder)
713713
columnOrderRef.current = newOrder
714714
}
715+
// Only the keys this action changes. Both sinks merge, and a patch carrying
716+
// an unchanged `columnWidths` snapshot would clobber a concurrent resize
717+
// whose write happened to land first.
715718
updateMetadataRef.current({
716719
pinnedColumns: newPinned,
717720
...(orderChanged ? { columnOrder: newOrder } : {}),
718-
columnWidths: columnWidthsRef.current,
719721
})
720722
}, [])
721723

@@ -1776,10 +1778,7 @@ export function TableGrid({
17761778
newOrder: finalOrder,
17771779
})
17781780
setColumnOrder(finalOrder)
1779-
updateMetadataRef.current({
1780-
columnWidths: columnWidthsRef.current,
1781-
columnOrder: finalOrder,
1782-
})
1781+
updateMetadataRef.current({ columnOrder: finalOrder })
17831782
}
17841783
}
17851784
setDragColumnName(null)
@@ -3199,10 +3198,7 @@ export function TableGrid({
31993198
const insertIdx = anchorIdx + (side === 'right' ? 1 : 0)
32003199
newOrder.splice(insertIdx, 0, newColumn)
32013200
setColumnOrder(newOrder)
3202-
updateMetadataRef.current({
3203-
columnWidths: columnWidthsRef.current,
3204-
columnOrder: newOrder,
3205-
})
3201+
updateMetadataRef.current({ columnOrder: newOrder })
32063202
},
32073203
[]
32083204
)

0 commit comments

Comments
 (0)