table
table copied to clipboard
Calling column.toggleVisibility for multiple columns will only toggle the first
Describe the bug
Calling toggleVisibility
on multiple columns in a forEach, will only toggle one of the columns.
Your minimal, reproducible example
https://codesandbox.io/p/sandbox/nervous-maria-kzvmjw?welcome=true&file=%2FREADME.md
Steps to reproduce
Click on "Toggle all in forEach" button and see that only the first column is toggled even though the onClick handler is
table.getAllLeafColumns().forEach((c) => c.toggleVisibility())
Expected behavior
I would expect all columns to be toggled
How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
MacOs 13.2.1 Chrome 110.0.5481.177 "@tanstack/react-table": "8.7.9", "react": "^18.2.0", "react-dom": "^18.2.0"
react-table version
8.7.9
TypeScript version
No response
Additional context
No response
Terms & Code of Conduct
- [X] I agree to follow this project's Code of Conduct
- [X] 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.
facing the same issue with react-table 8.10.7
Look like it's related to React Strict Mode, disabled strict mode and the issue is gone, but i do not want to disable the strict mode