Can I set the amount of scrolling that triggers the next page for an infinite query?
I am using an Infinite query which automatically loads new data when I scroll to a certain point in the app. This is working well. But to improve perceived performance for the user, I wanted for it to already start loading a bit earlier during the scroll. Is there a way to already trigger fetching of the next page at an earlier scroll height than the default? I couldn't find a setting for it.
2 Replies
other-emerald•17mo ago
How do you do it now? Probably with an intersection observer at the end of the list. So just put it a but higher up
ugly-tanOP•17mo ago
Oh yes, apologies, I am using an InfiniteScroll component and forgot it was not part of react-query but of another library (https://www.npmjs.com/package/react-infinite-scroller). If anyone finds this question for reference, in that library one can set a
threshold
property.