Skip to content
Discussion options

You must be logged in to vote

without an exit condition, this will of course trigger an infinite render, because every fetch triggers onSuccess, which triggers another fetch, which triggers onSuccess, ...

the question is when you do you want to fetch the next page? There is no prefetching once a query is displayed because fetching the next page will just display it as well.

what we do in the examples is use an intersection observer and fetch the next page when this element gets into the viewport. This can be at the very end of the list, or e.g. 5 entries before that. That way, when the user scrolls to the "almost bottom", the fetch will happen, and by the time they are at the bottom, they will see the new entries.

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@aniketbiswas21
Comment options

@TkDodo
Comment options

@aniketbiswas21
Comment options

@TkDodo
Comment options

@aniketbiswas21
Comment options

Answer selected by aniketbiswas21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #3865 on July 19, 2022 14:24.