[Bug] List with CellMeasurer not scrolling properly
Description:
When rendering a List with CellMeassure and scrollToIndex is set on the last index of the list. It gets "freezed" at that position, so it can't be scrolled up.
Reproducible here: Plunker
Affected version: v9.12.0
Based on #871, I suspect CellMeasurer is not require in order to reproduce this bug.
Some interesting info to add:
- this happens no matter the index
- this resets to the position only when scrolling up
In the Plunker, if you set the scrollToIndex={300} you can scroll down but not up:

I got a little further on this and I think I understand the problem
What's happening is that the CellMeasurer is coming to new cells and calling Grid.invalidateCellSizeAfterRender. That's eventually getting to this line:
this._recomputeScrollTopFlag = scrollToRow >= 0 && rowIndex <= scrollToRow;
Which will reset the scrollTop on the next cDU only when scrolling up. If you reverse the <= to >= then the same problem happens when scrolling down
Is there some viable solution available? I am using version 9.21.0 and this issue is still present :/ I am not even using CellMeasurer, so it's probably more related to #871.
This appears to have been fixed as of version 9.20.1. At least the plunker example originally referenced seems to work with that version or newer.
I should have written that this appears to have been partially fixed as of version 9.20.1. Can anyone share an example where the problem still exists in the current version?
In version 10, scrollToIndex is no longer a controlled prop. Call scrollToRow({ index }) on the List's ref instead. It scrolls once and is never re-applied, so the list doesn't snap back to that row when CellMeasurer measures new rows, and scrolling up from the last row works.