fix(tables): decouple master checkbox from cell-range#4464
fix(tables): decouple master checkbox from cell-range#4464waleedlatif1 wants to merge 1 commit intostagingfrom
Conversation
…ected flag Master checkbox detached from gutter selection state when rows or columns changed after Cmd+A: the predicate matched normalizedSelection bounds exactly (endRow === rows.length-1, endCol === displayColumns.length-1), so any post-selection growth flipped it false while the cell-range overlay still painted every row checked. Replace the structural two-branch predicate with an explicit allRowsSelected flag plus a uniform set-membership check. handleSelectAllRows sets the flag in O(1); handleRowToggle materializes checkedRows when toggling out of "all" mode. Bulk-op read sites (delete, copy, cut, selectedRowCount) honor the flag. Decouple gutter checkbox from cell-range drag: dragging cells no longer fills gutter checkboxes — they reflect explicit row-selection intent only, matching Sheets/Airtable. Cell-range overlay still paints cells.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview Updates row checkbox behavior so gutter checkboxes reflect only explicit row selection (or master select-all), while cell-range selection no longer implicitly checks rows. Bulk operations (context-menu delete, Delete/Backspace clear, copy, cut, and Reviewed by Cursor Bugbot for commit 22b555e. Configure here. |
Greptile SummaryThis PR replaces the structural
Confidence Score: 3/5Safe to merge with the context-menu delete fix applied; without it, rows arriving after a bulk delete will silently appear selected and could be unintentionally included in the next bulk operation. The flag is reset consistently across every keyboard, mouse, and column-selection path, but apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table/table.tsx — specifically the Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A([User presses Cmd+A]) --> B[handleSelectAllRows]
B --> C[setAllRowsSelected true
setCheckedRows EMPTY
setSelectionAnchor/Focus all]
C --> D{User action?}
D -->|Click cell| E[handleCellMouseDown
setAllRowsSelected false
setCheckedRows EMPTY]
D -->|Click gutter checkbox| F[handleRowToggle
wasAllSelected materializes
checkedRows from rowsRef
setAllRowsSelected false]
D -->|Navigate/Tab/Arrow| G[Keyboard handler
setAllRowsSelected false
setCheckedRows EMPTY]
D -->|Column select| H[handleColumnSelect
setAllRowsSelected false
setCheckedRows EMPTY]
D -->|Context-menu Delete| J[handleContextMenuDelete
collectRowSnapshots ALL
setDeletingRows
closeContextMenu
allRowsSelected NOT reset]
J --> K[rows becomes empty
isAllRowsSelected = false]
K --> L{New row arrives?}
L -->|Yes| M[allRowsSelected still true
new row shows as checked]
L -->|No| N[Visually correct]
|
|
Superseded by #4466, which contains this commit plus a follow-up refactor that collapses the dual selection state into a single discriminated union. |
Summary
allRowsSelectedflag plus a uniform set-membership check.handleSelectAllRowssets the flag in O(1);handleRowTogglematerializescheckedRowswhen toggling out of "all" mode. Bulk-op read sites (delete, copy, cut, selectedRowCount) honor the flag.Type of Change
Testing
Tested manually. Type check + biome clean.
Checklist