react-virtualized: scroll up an infiniteLoader that has scrollToIndex set bounces back to scrollToIndex
repro steps:
- have an infiniteloader with a list (or grid or …) with scrollToIndex set to something like 10000 => the list shows starting at the corresponding line
- scroll back up
- after a few lines the list jumps back to 10000 (only a few lines for Firefox, a bit more for Chrome) => this is only triggered when fresh data is loaded.
some investigation:
It looks very similar to https://github.com/bvaughn/react-virtualized/issues/595:
recomputeGridSize is called by InfiniteLoader once its new rows load. This in turn sets the _recomputeScrollTopFlag flag to true.
_recomputeScrollTopFlag is set to true in recomputeGridSize as follow:
this._recomputeScrollTopFlag = scrollToRow >= 0 && rowIndex <= scrollToRow;
I’m suspecting that this code is only valid when scrolling down but not up. If this is correct, recomputeGridSize should use this.state.scrollDirectionVertical to compute _recomputeScrollTopFlag and the same issue likely applies to horizontal scrolling too.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 16 (5 by maintainers)
Commits related to this issue
- fix for #998 — committed to dcolens/react-virtualized by didiercolens 6 years ago
- fix for #998 (#1001) * fix for #998 * add patch for scrollToColumn too * prettier — committed to bvaughn/react-virtualized by dcolens 6 years ago
- Revert "fix for #998 (#1001)" This reverts commit 6226f56b4ed91c23db2521b5ba772374aeaca680. — committed to bvaughn/react-virtualized by wuweiweiwu 6 years ago
- Revert "fix for #998 (#1001)" (#1103) This reverts commit 6226f56b4ed91c23db2521b5ba772374aeaca680. — committed to bvaughn/react-virtualized by wuweiweiwu 6 years ago
- fix for [998](https://github.com/bvaughn/react-virtualized/issues/998) with test cases — committed to mengdage/react-virtualized by mengdage 6 years ago
- fix for [998](https://github.com/bvaughn/react-virtualized/issues/998) with test cases — committed to mengdage/react-virtualized by mengdage 6 years ago
- fix for https://github.com/bvaughn/react-virtualized/issues/998 with test cases — committed to mengdage/react-virtualized by mengdage 6 years ago
- fix for #998 with test cases (#1154) — committed to bvaughn/react-virtualized by mengdage 6 years ago
- Merge remote-tracking branch 'bvaughn/master' into invalidate-caches * bvaughn/master: (54 commits) Update version and changelog for 9.21.0 release (#1252) chore: update lockfile Update ci badg... — committed to IdeaFlowCo/react-virtualized by errendir 6 years ago
@wuweiweiwu Hi, it seems like people are too busy to fix this bug. I create https://github.com/bvaughn/react-virtualized/pull/1154 with fixed tests.