Description
TanStack Table version
8.20.5
Framework/Library version
18.3.1
Describe the bug and the steps to reproduce it
The row selection state is a Record<string, boolean>
(where the key is the row ID). As such, a row is selected if :
- a record with key matching the row ID exists in the state
- its value is
true
The current implementation of the getIsSomeRowsSelected
method misses point #2 and only checks for existence of keys in this state.
I'm ready to open a PR for it, but IMHO the problem also comes from using a complicated state structure (a record) in lieu of a regular list (or a Set) (with which the row is selected if its ID is present in the list/set) : the whole selection model would benefit from a refactoring.
In the meantime, it is possible to fallback on the table.getSelectedRowModel().rows.length !== 0
as a workaround.
Your Minimal, Reproducible Example - (Sandbox Highly Recommended)
//
Screenshots or Videos (Optional)
No response
Do you intend to try to help solve this bug with your own PR?
Yes, I think I know how to fix it and will discuss it in the comments of this issue
Terms & Code of Conduct
- I agree to follow this project's Code of Conduct
- I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.
Activity