tbranyen / hyperlist

A performant virtual scrolling list utility capable of rendering millions of rows

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

When scrolling up, items are not rendered in advance

timavaza opened this issue · comments

Hi there,

I notice that the behaviour scrolling up seems different from scrolling down.
Often when scrolling down, there's a threshold of pre-loaded items below the container so that there's fewer instances of a blank white container. However when scrolling back up, you frequently see a blank container as it seems the items aren't preloaded.

Also would be good if there were options to specify the number of items rendered above & below the visible container.

Nice tool!
Thanks!

I was running into this issue too, and I believe I have the fix for this, which is a single line of code.

(on ../lib/index.js) Change line 92 from:
if (!lastRepaint || diff < 0 || diff > this._averageHeight) {
to
if (!lastRepaint || Math.abs(scrollTop - lastRepaint) > 0) {

The comparison to averageHeight prevents this from rendering while scrolling up if the scroll doesn't exceed the averageHeight value.

Hi Joe,
I found that fix didn't work for us.. as you scroll a list back up, up to half the list still goes white...
Thanks for trying though.. maybe our scenario's a little different to yours.

Same for me, the above fix didn't work