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
It appears that simply invoking table.getRowModel() has the side-effect of causing rows to collapse.
What I Did
In the attached minimal reproducible example, I am displaying the expanded state of the table, which starts out as true (i.e. expanded).
There is a button on screen labeled "Press me". Pressing that button should set the data to basically a copy of itself. This is what I found to be the least amount of work that I could do in order to get the behavior to appear, but is otherwise a no-op.
Expected Behavior
After pressing the button, I expect the rows to remain expanded, since I'm not explicitly toggling any expanded state anywhere in this example.
Actual Behavior
When I press the button labeled "Press me", you will see the expanded state unexpectedly changes to {}, indicating that all rows are now collapsed.
Oddly, this behavior only appears to happen when table.getRowModel() is invoked, which doesn't seem obvious. If you comment out that line, you'll see that pressing the button does not collapse the rows.
As a side note, I also noticed that commenting out the getGroupedRowModel property will also suppress this behavior; this seems unrelated, but I don't understand the intricacies here to know if that's expected behavior as well.
I'm intentionally not rendering a visual table in this example so as to minimize distraction; after all, TanStack table is meant to be headless.
If the behavior demonstrated in this example is intended, could you kindly help me understand why? It is not obvious to me why the rows collapse here.
I'm grateful for any help or direction that you could share.
Your Minimal, Reproducible Example - (Sandbox Highly Recommended)
Do you intend to try to help solve this bug with your own PR?
No, because I do not know how
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.21.2
Framework/Library version
React v18.2.0
Describe the bug and the steps to reproduce it
It appears that simply invoking
table.getRowModel()
has the side-effect of causing rows to collapse.What I Did
In the attached minimal reproducible example, I am displaying the
expanded
state of the table, which starts out astrue
(i.e. expanded).There is a button on screen labeled "Press me". Pressing that button should set the data to basically a copy of itself. This is what I found to be the least amount of work that I could do in order to get the behavior to appear, but is otherwise a no-op.
Expected Behavior
After pressing the button, I expect the rows to remain expanded, since I'm not explicitly toggling any expanded state anywhere in this example.
Actual Behavior
When I press the button labeled "Press me", you will see the expanded state unexpectedly changes to
{}
, indicating that all rows are now collapsed.Oddly, this behavior only appears to happen when
table.getRowModel()
is invoked, which doesn't seem obvious. If you comment out that line, you'll see that pressing the button does not collapse the rows.As a side note, I also noticed that commenting out the
getGroupedRowModel
property will also suppress this behavior; this seems unrelated, but I don't understand the intricacies here to know if that's expected behavior as well.I'm intentionally not rendering a visual table in this example so as to minimize distraction; after all, TanStack table is meant to be headless.
If the behavior demonstrated in this example is intended, could you kindly help me understand why? It is not obvious to me why the rows collapse here.
I'm grateful for any help or direction that you could share.
Your Minimal, Reproducible Example - (Sandbox Highly Recommended)
https://codesandbox.io/p/sandbox/peaceful-lewin-cl58vv
Screenshots or Videos (Optional)
No response
Do you intend to try to help solve this bug with your own PR?
No, because I do not know how
Terms & Code of Conduct
The text was updated successfully, but these errors were encountered: