fix: group row ID leaks into rowSelection when selecting grouped rows#1513
Open
VC-Semih wants to merge 2 commits intoKevinVandy:v3from
Open
fix: group row ID leaks into rowSelection when selecting grouped rows#1513VC-Semih wants to merge 2 commits intoKevinVandy:v3from
VC-Semih wants to merge 2 commits intoKevinVandy:v3from
Conversation
…hen grouping TanStack's toggleSelected() on a group row correctly propagates to leaf rows but also writes the synthetic group row ID (ex: "city:Paris": true) into rowSelection as a side effect. After the toggle, removing the group row ID from rowSelection via setRowSelection, leaving only the leaf row IDs. Fixes KevinVandy#1226
… when grouping getIsAllPageRowsSelected(), getIsAllRowsSelected(), and getIsSomeRowsSelected() include group rows in their denominator, so the header checkbox checked and indeterminate states couldn't resolve correctly when grouping was active. Replaced all three with a leaf-only helper that filters flatRows with getIsGrouped(). Fixes KevinVandy#1226
|
@VC-Semih is attempting to deploy a commit to the Kevin Vandy OSS Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1226
Problem
When grouping is active, selecting a group row (e.g. "gender:Male") causes
its synthetic ID to be written into
rowSelectionas a side effect ofTanStack's
toggleSelected().Changes
row.utils.tsgetMRT_RowSelectionHandler: afterrow.toggleSelected(), remove the grouprow ID from
rowSelectionviasetRowSelection, leaving only the leaf rowIDs.
getMRT_SelectAllHandler: replacetoggleAllPageRowsSelected()/toggleAllRowsSelected()with a manual loop overflatRowsfiltered toleaf rows only.
MRT_SelectCheckbox.tsxReplace
getIsAllPageRowsSelected()/getIsAllRowsSelected()andgetIsSomeRowsSelected()with leaf-only computations withgetIsGrouped(),as all three native methods include group rows in their denominator.