My use case is that I am using List component of react-virtualised for building a log container to render the logs in the reverse order.
Working
We fetches the logs in batches. Initially we are fetching the last batch of the log and rendered on the screen. We continuously fetching the older batches of log and update the log array. Irrespective of whether the user are scrolling at the top or not.
Issue
when ever the log array got updated the scroll position also changed to the top. suppose we fetch logs in the batches of length 10 and only 5 log can be displayed to the user at a time. initially when we fetched the last batch of the log, the initial condition will be logArray = [40, 41 ....50]
On UI these 5 logs will be shown
[
40 <- scroll position
...
44
45
]
when the another batch of 10 log get loaded the logArray becomes [30, 31 ....47, 48,49, ....50] and on UI
[
30 <- scroll position
...
34
35
]
So our issue is to restrict the scroll to move at the top at every time logArray gets updated. As it creates a bad user experience if user is reading the middle logs and is taken at the top forcefully.