fix(table-core): skip onColumnVisibilityChange for a redundant toggle-all - #6540
fix(table-core): skip onColumnVisibilityChange for a redundant toggle-all#6540lazerg wants to merge 1 commit into
Conversation
9323898 to
45e481d
Compare
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
📝 WalkthroughWalkthrough
ChangesColumn visibility no-op
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Closing this since the linked issue (#6539) has been closed, so this fix isn't needed anymore. Thanks anyway for taking a look at it. |
🎯 Changes
table_toggleAllColumnsVisiblerebuilds the whole visibility map and hands it totable_setColumnVisibilityunconditionally, so asking for a state the table is already in still runsonColumnVisibilityChange:setStateSlicecan't catch this one. The map it receives ({ id: true, firstName: true, ... }) is structurally different from the{}the state usually holds while every column is visible, so the two never compare equal. The fix compares the map against each leaf column's current visibility instead and returns early when they already agree, the same kind of explicit no-op checktable_toggleAllRowsExpandedkeeps.Two existing tests toggled all columns on from a table where everything was already visible, which is now a no-op. Both start from a hidden
firstNameinstead, so they still exercise the show-all path.Fixes #6539
✅ Checklist
pnpm run test:pr.Two tests added to
columnVisibilityFeature.utils.test.ts, both verified to fail onmain: one for the already-all-visible case, one for the already-all-hidden case.🚀 Release Impact
Summary by CodeRabbit
Bug Fixes
Documentation