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

Fixed infinite loader jumping to the top row when scrolling fast #632

Merged
merged 1 commit into from
Mar 31, 2017

Conversation

reVrost
Copy link
Contributor

@reVrost reVrost commented Mar 28, 2017

Hi,
I've been using react-virtualized recently for my personal project to build an electronjs app. And, this turns out to be such an awesome library to use. Thanks for the amazing work!

Anyway, I've found some weird glitch on InfiniteLoader, so I figured I'd give it a go at fixing it.
I'm not sure if I should create an issue first or if a straight pull request is ok.
Anyway, I created a pull request so here it is:

The glitch is happening when you scroll too fast on infinite loader while using an ArrowKeyStepper. Every time you scroll fast it just seems to jump straight to the top row. I've created a plunkr to demonstrate this.

After debugging through the code, I noticed that:
forceUpdateReactVirtualizedComponent is called when refreshing visible
rows after loading data. This resulted in a call chain from
recomputeRowHeights with no args, which eventually led to a call to
recomputeGridSize with 0 rowIndex.

The fix was to pass in the currentIndex to preserve the current visible
row.

Let me know if this fix is correct and/or if i need to do anything more like writing test cases for this.

Thanks!

forceUpdateReactVirtualizedComponent is called when refreshing visible
rows after loading data. This resulted in a call chain from
recomputeRowHeights with no args, which eventually led to a call to
recomputeGridSize with 0 rowIndex.

The fix was to pass in the currentIndex to preserve the current visible
row.
@bvaughn
Copy link
Owner

bvaughn commented Mar 30, 2017

Thanks so much for this PR! I'll try to review it soon- maybe tonight, if not- this weekend!

@bvaughn bvaughn merged commit 0e59d30 into bvaughn:master Mar 31, 2017
@bvaughn
Copy link
Owner

bvaughn commented Mar 31, 2017

This will go out with the next release!

@reVrost
Copy link
Contributor Author

reVrost commented Mar 31, 2017

Awesome!

@bvaughn
Copy link
Owner

bvaughn commented Mar 31, 2017

Published in 9.4.1 Gave you props in the CHANGELOG. Thanks again!

@bmakuh
Copy link

bmakuh commented Feb 12, 2018

It seems like this issue may have resurfaced. I was seeing this behavior when I return null in a rowRenderer rather than returning a placeholder row, and when I do return a placeholder row and scroll quickly then I'm seeing a different bug where some of the fetched data gets dropped rather than saved into my Redux store. I can work on a plunkr repro case tomorrow.

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