You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The return value of table.getIsSomeRowsSelected is inconsistent when using the grouping feature, sometimes returning an erroneous value. Might be related to #4878
I think this issue might be caused by the grouped row being considered in the selected state object of the table, even if it not a "real" row coming from the dataset. The getIsSomeRowsSelected function checks if the total number of rows selected is less than the flat rows of the filtered row model. Flat rows only returns rows included in the dataset, grouped columns are not part of this array.
However, since the selection state is including the "fictional" gruped columns it becomes possible for the totalSelected variable to be greater than the flatRows length.
Maybe grouped columns should not be considered for the selected state, since they are not items in the data array. Clicking on it should toggle subrows without including the grouped column in the state.
Do you intend to try to help solve this bug with your own PR?
Maybe, I'll investigate and start debugging
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.
The text was updated successfully, but these errors were encountered:
TanStack Table version
v8.20.1
Framework/Library version
React 18.3.1
Describe the bug and the steps to reproduce it
The return value of table.getIsSomeRowsSelected is inconsistent when using the grouping feature, sometimes returning an erroneous value. Might be related to #4878
I think this issue might be caused by the grouped row being considered in the selected state object of the table, even if it not a "real" row coming from the dataset. The getIsSomeRowsSelected function checks if the total number of rows selected is less than the flat rows of the filtered row model. Flat rows only returns rows included in the dataset, grouped columns are not part of this array.
However, since the selection state is including the "fictional" gruped columns it becomes possible for the totalSelected variable to be greater than the flatRows length.
Maybe grouped columns should not be considered for the selected state, since they are not items in the data array. Clicking on it should toggle subrows without including the grouped column in the state.
Steps to reproduce
Your Minimal, Reproducible Example - (Sandbox Highly Recommended)
https://codesandbox.io/p/devbox/tanstack-grouping-and-selection-4kyzxd?workspaceId=a99c66fb-3472-4189-a44e-72c9121d3c0a
Screenshots or Videos (Optional)
Screen.Recording.2024-08-08.at.12.08.20.p.m.mp4
Do you intend to try to help solve this bug with your own PR?
Maybe, I'll investigate and start debugging
Terms & Code of Conduct
The text was updated successfully, but these errors were encountered: