Skip to content
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

Fix bug in WindowScroller::updatePosition #1642

Merged
merged 3 commits into from
Apr 7, 2021

Conversation

yamadapc
Copy link
Contributor

Hello, I'm opening this PR to fix a bug found in the WindowScroller::updatePosition method.

I've pushed a full sandbox reproduction of the bug, with documentation of what is the problem and the fix to https://codesandbox.io/s/7mdt8. I'd be happy to discuss the problem further on a video-call and or send you a video-recording I've of it through e-mail.

In summary, the bug happens when trying to react to "header height" changes with WindowScroller. The documentation points to calling WindowScroller::updatePosition, however, while that updates the cached position on the WindowScroller instance variables, it does not update the scrollTop state variable. This causes virtual-lists linked to it to not properly render immediately after a header height change; only after a subsequent scroll event.

I've added E2E tests which reproduce the error and a prop that fixes it by forcing a scroll event handler call.

There're tests for the prop being true/false so we can see that when it's false the problem exists but when true the problem is fixed.

The fix is essentially flagged by this prop and would be opt-in. I'm not sure if that's the best way.

@yamadapc yamadapc merged commit 940cc65 into bvaughn:master Apr 7, 2021
yamadapc pushed a commit to yamadapc/react-virtualized that referenced this pull request Apr 13, 2021
After further testing, I've found that after `handleWindowScrollEvent`
is called we also need to force the `isScrolling` state variable to turn
back to false (otherwise there might be issues with rendering rows that
depend on `isScrolling`).
@thexpand
Copy link

When is this planned for release?

yamadapc added a commit that referenced this pull request Apr 19, 2021
After further testing, I've found that after `handleWindowScrollEvent`
is called we also need to force the `isScrolling` state variable to turn
back to false (otherwise there might be issues with rendering rows that
depend on `isScrolling`).
@yamadapc
Copy link
Contributor Author

I'll release it in the next few days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants