Skip to content
Discussion options

You must be logged in to vote

Thanks for sharing your use-case. I think it's quite unique, and doing the same thing in v5 will require some changes on your end, but I think it's possible:

  1. I'd use refetchInterval instead of manually calling refetch. If you only want it to be enabled on the last page, you can pass a function to it, like: refetchInterval: (data) => and then compute the interval. If you are not on the last known page, just return false or 0, and if you are on the last known page, return the number (in milliseconds) for your interval.

  2. I'd just let react-query refetch all the pages, and implement an opt-out mechanism in the queryFn. This can look something like this (pseudo code):

const queryKey = ne…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@rodrigofariow
Comment options

@TkDodo
Comment options

Answer selected by TkDodo
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants