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

Most upvoted comments

@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.