roeierez / infinite-list

Infinite list in javascript that scrolls in 60fps
623 stars 45 forks source link

Native scrolling: rapid scrolling causes duplicate load requests #20

Closed juvation closed 7 years ago

juvation commented 7 years ago

i'm evaluating infinite-list and have a tiny test app. the config is set so that no items are initially loaded and "hasMore" is true. my page fetcher function just setTimeout()s for a second and then makes items. in the callback, i set hasMore to true if the loaded data set exceeds 200 items.

if i scroll rapidly, i see multiple requests for the same data set - just now i saw three calls to pageFetcher(50), and the itemRenderer function gets called before the items have been loaded. so i think infinite-list isn't waiting for the pageFetcher function to return before generating more calls to load.

the mobile scrolling version doesn't exhibit this issue, btw! that works great.

thanks for doing this, much appreciated.

roeierez commented 7 years ago

Hi Jason, are you using the npm package? I think this issue was fixed on master. If it this is the case let me know and I will also update the npm package that is behind the master branch.

juvation commented 7 years ago

hi Roei, thanks for the response.

i just get a zip file and extract the Js file from the "dist" directory. the copy of the master branch Js file i have has no mention of native scrolling. where would i get the latest most capable Js file?

thanks!

juvation commented 7 years ago

it is fixed in the master branch, but i need native scrolling for desktop. will the fix go in the native scrolling branch?

roeierez commented 7 years ago

I have missed a merge from the master, let me merge the mater into the native_scroller branch and then you can check it. Will let you know.

juvation commented 7 years ago

thanks! i look forward to the merge :-)

roeierez commented 7 years ago

I have came to a conclusion that it will take me more time to test the merge, so I have commited a fix in the native_scroller branch for this issue, appreciate if you can check that.

juvation commented 7 years ago

thanks for the fix. i'm not seeing the original issue any more, yay. with this new version i was initially seeing blank screens if i scrolled really brutally fast, but i can no longer reproduce it.