-
-
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 scrollbar position not being updated after scrollToIndexes
#14877
Conversation
Deploy preview: https://deploy-preview-14877--material-ui-x.netlify.app/ |
…should be changed
b072d21
to
6ac90b3
Compare
@arminmeh |
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've updated the PR description with Before/After sandboxes. It looks good to me!
Thanks @cherniavskii |
Updated! |
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.
@arminmeh I just noticed that this PR introduced a regression: https://deploy-preview-14877--material-ui-x.netlify.app/x/react-data-grid/#premium-plan
Screen.Recording.2024-10-08.at.22.09.55.mov
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'll take a look
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.
Fixes #14830
scrollToIndexes
eventually ends up heremui-x/packages/x-data-grid/src/hooks/features/scroll/useGridScroll.ts
Lines 147 to 152 in 5260148
virtualScroller
gets the update and the scrollbar follows via an event listenerIn this scenario, only
scrollbar
should be updated, since this was already done for thescroller
. it looks like that, in some cases,scroller
event gets executed first and it locksscrollbar
update with theisLocked
flag set totrue
.I have changed this to work with the last position (it was already used in one event listener). This means that the event listeners will run as long as the elements are not at the right position.
As mentioned in the issue, it was already really hard to reproduce the bug, but I notice that after update, the scrollbar gets rendered and displayed after every click, while before it would update in the background.
Before: https://codesandbox.io/p/sandbox/trusting-night-rcm484
After: https://codesandbox.io/p/sandbox/ecstatic-hertz-94g86f