Skip to content

Commit 11fc89d

Browse files
waleedlatif1claude
andcommitted
refactor(tables): phase 2-5 — selection by array index, checks by row id
Decouple Tables UI selection coordinates from DB position: - rowIndex semantics shift from row.position to array index across selection state, mouse handlers, keyboard nav, paste, scrollIntoView - checkedRows: Set<number> (position) → Set<string> (rowId), survives sort/filter and realtime row inserts - lastCheckboxRowRef stores rowId; shift-click range resolves to current array indices for visual-order ranges - Drop positionMap/maxPosition derived state in favor of direct rowsRef reads - ExpandedCellPopover anchors via data-row-id (row-id-stable) instead of data-row (array index) - collectRowSnapshots accepts Iterable<TableRowType> directly - Add bounds-validation effect to clamp anchor/focus when rows.length shrinks (sort change, pagination, realtime delete) - Drop redundant arrayIndex prop on DataRow (rowIndex now equals it) Server-side position math stays at API boundary only: insertRow, duplicateRow, shift-Enter append, paste create-batch, undo snapshots. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 9ad8b12 commit 11fc89d

3 files changed

Lines changed: 117 additions & 119 deletions

File tree

apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table/cells/expanded-cell-popover.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export function ExpandedCellPopover({
7878
return
7979
}
8080
setDraftValue(isEditable ? formatValueForInput(target.value, target.column.type) : '')
81-
const selector = `[data-table-scroll] [data-row="${target.row.position}"][data-col="${target.colIndex}"]`
81+
const selector = `[data-table-scroll] [data-row-id="${target.row.id}"][data-col="${target.colIndex}"]`
8282
const el = document.querySelector<HTMLElement>(selector)
8383
if (!el) {
8484
setRect(null)

0 commit comments

Comments
 (0)