Fixed infinite loader jumping to the top row when scrolling fast #632
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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!