-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DataGrid] Fix column selector crash when hiding columns #875
[DataGrid] Fix column selector crash when hiding columns #875
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had a look at the logic, a couple of thought:
- The name of
isEqual
is confusing. It's a deep equal,isDeepEqual
would be clearer. - I have tried to remove the
if (renderNewColState || newRenderedColState == null) {
branch, and couldn't notice any perf rendering different. TheupdateRenderedCols
method was returning the same order of true/false sequences. If we can remove it, and remove the need for another state in a ref, that would be even better. - If we can't remove the branch, I would suggest we isolate the logic more to compute a
const lastVisibleIndexChanged?: boolean
independently.
packages/grid/_modules_/grid/hooks/features/virtualization/useVirtualColumns.ts
Outdated
Show resolved
Hide resolved
packages/grid/_modules_/grid/hooks/features/virtualization/useVirtualColumns.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
packages/grid/_modules_/grid/hooks/features/virtualization/useVirtualColumns.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Guys is there something else needed for this PR. I was thinking about how to test that corner case but couldn't come up with a good test case (only hiding and showing N columns won't cut it). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this one is hard to test end-to-end. It's probably the kind of stuff to test with unit tests, like https://devexpress.github.io/devextreme-reactive/ are doing but I'm not sure it's worth it yet (it's a mess for refactoring). The logic of the fix is healthy: be less stateful, rely less on global refs.
Fixes #856