Skip to content

fix: improve row selection handling and clean up code, fixes: #1504#1505

Open
kevenleone wants to merge 2 commits into
prisma:mainfrom
kevenleone:checkbox-row
Open

fix: improve row selection handling and clean up code, fixes: #1504#1505
kevenleone wants to merge 2 commits into
prisma:mainfrom
kevenleone:checkbox-row

Conversation

@kevenleone

@kevenleone kevenleone commented May 3, 2026

Copy link
Copy Markdown

Fixes: #1504

Screen.Recording.2026-05-02.at.23.35.36.mov

kevenleone added 2 commits May 2, 2026 23:30
The __ps_select column rendered empty cells with no visual
state indicator. Render CheckboxTable inside header and cell
with pointer-events-none so selection stays handled by
DataGrid mousedown handlers.

@sorenbs sorenbs left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @kevenleone β€” thanks a lot for tackling this, and for the clear demo video! Restoring the checkboxes as presentation-only elements (pointer-events-none) while keeping all pointer handling in DataGrid is exactly the right architecture, and the toggle-on-click behavior also addresses the "can't unselect" complaint from #1488. A few changes needed before we can merge:

  1. Drag-select still overwrites multi-selection. selectRowsInRange replaces the entire selection, so after checking rows 1 and 3, click-dragging rows 6–8 silently drops 1 and 3 β€” the same "overwritten" symptom from #1504, just via the drag path. Could you make range-drag merge into the existing selection (or clear the drag anchor when a click toggles a row off)? Related: clicking a selected row deselects it but still arms the drag ref, so a tiny mouse movement re-selects it.
  2. Reuse the existing components. ui/studio/cell/SelectHeaderCell.tsx and SelectRowCell.tsx already exist (currently unused) and are almost exactly the JSX you added inline in three places β€” please adapt/reuse them (or delete them) rather than duplicating.
  3. Indeterminate header state. With a partial selection the header checkbox looks unchecked β€” table.getIsSomeRowsSelected() ? "indeterminate" : false would be clearer.
  4. Lint. The two re-formatting hunks in DataGrid.tsx fail the repo's pinned prettier (looks like an editor prettier-version mismatch) β€” please drop them. There's also a new exhaustive-deps warning: selectSingleRowMode is still used in the right-click branch but was removed from the deps array. And with plain click now toggling, the Shift+click branch is identical code β€” worth unifying.
  5. Regression test + changeset. Per repo convention, bugfixes need a test that reproduces the bug (checkboxes render / additive selection would be great additions to DataGrid.interactions.test.tsx) and a .changeset/*.md entry so the fix ships in a release.

Happy to re-review once these are in β€” the core approach is solid and this will be a nice usability win. Thanks again!

@kevenleone

Copy link
Copy Markdown
Author

Thanks @sorenbs for your review, working on the changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Select row and select all rows are missing checkboxes and unusual behavior

2 participants