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
{{ message }}
Repository navigation
Expanding API including rows that dont include a subRow #6115
While using the expanding api within tanstack table, I noticed that the expanding doesn't take into consideration rows that don't have subrows.
This is only obvious when you open all rows (in my example I have set the initial expanded state to true) and then close just 1 row. If you have a look at the expanded state, it now includes every row's index, including the ones that don't have subrows.
To show this I have used the default expandable example and made a few edits but the main change is I have made it that only even numbered rows have subrows.
Steps to reproduce
View this sandbox. Everything should be open and the expanded state is true
Close the 2nd row. This should now generate the expanded state. And you should see that both 0 and 3 are now true, which shouldn't even better in the object as those aren't rows that can expand.
This also happens for deep nested rows which means your .getExpandedDepth() is actually incorrect as its giving you a max depth that isn't actually possible.
Steps to reproduce this other issue
View this sandbox. Everything should be open and the expanded state is true
Close every expandable row individually. Even though all the rows should be uncollapsed now. The expanded state still includes entries but all of them are invalid entires as their rows dont have sub rows.
I would expect those keys to not be in the object as they dont have a sub row
Your Minimal, Reproducible Example - (Sandbox Highly Recommended)
Do you intend to try to help solve this bug with your own PR?
Yes, I am also opening a PR that solves the problem along side 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.
I have found the issue and have crated a PR for the fix. The problem was that if the old expanded state was true was just adding in all the rowId's into the state object and not checking if that row is actually an expandable row
Activity
RichardHpa commentedon Oct 21, 2025
I have found the issue and have crated a PR for the fix. The problem was that if the old expanded state was
truewas just adding in all the rowId's into the state object and not checking if that row is actually an expandable row#6116
fix(table-core): correct expanded/paginated state contents and sortin…
fix(table-core): correct expanded/paginated state contents and sortin…