TanStackT
TanStackโ€ข12mo agoโ€ข
4 replies
skinny-azure

react queyr with maxPages and virtualized list

i am building a virtualized list using tanstack query's infinite scroll with maxPages of, for example, 3

using virtuoso for this, scrolling works fine for fetching UNTIL we get to 3 pages, say we have

[a,b,c], when we fetch the new one, the array becomes [b,c,d], so when the new page loads, virtuoso places me at the end of d which causes another refetch because we are at the bottom of the list

this might be SUPER specific, but how could i make it so it knows that we were instead at the end of c?

i am aware i could scroll to the end of 'c' when the page loads, but if the user scrolls while the page is loading, it might just drag them back there which isnt great either i think

going crazy on this one, hopefully someone here has done something similar before ๐Ÿ˜„ thanks
Was this page helpful?