Skip to content

fix(table-core): Do not select subrows if enableSubRowSelection is set to false - #5274

Closed
jpedroh wants to merge 3 commits into
TanStack:mainfrom
jpedroh:fix-gh-5116
Closed

fix(table-core): Do not select subrows if enableSubRowSelection is set to false#5274
jpedroh wants to merge 3 commits into
TanStack:mainfrom
jpedroh:fix-gh-5116

Conversation

@jpedroh

@jpedroh jpedroh commented Jan 14, 2024

Copy link
Copy Markdown
Contributor

Fixes #5116.

There are two cases here that were not being covered by the current code:

  • If enableSubRowSelection is a boolean and is set to true, then only the first level of rows should be selected. We can easily achieve this by iterating over rows instead of flatRows.
  • The more complicated case is when enableSubRowSelection is a function. In this scenario we must run the check recursively for all subrows. The easiest way I've found to solve this was to just iterate over rows using the mutateRowIsSelected helper function.

In order to not losing the performance improvement that was already implemented, I've kept the old flow and just in case enableRowSeleciton is a function, we will reach the slower path (which might not be very common anyway)

@jpedroh
jpedroh marked this pull request as draft January 14, 2024 14:51
@KevinVandy

Copy link
Copy Markdown
Member

closing in favor of #6495

@KevinVandy KevinVandy closed this Aug 2, 2026
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.

getToggleAllRowsSelectedHandler doesn't take into account enableSubRowSelection property

2 participants