How to prevent refetch on mount for infinite queries #2966
Unanswered
naresh1021
asked this question in
Q&A
Replies: 1 comment 4 replies
-
The example you showed doesn't have maybe you have seen a different refetch, like a window focus refetch that can happen when you go to the network tab and back? It's a very common gotacha during development. I also find it better to set |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Is there a way to prevent refetching of the data on mount for an infinite query? I have an infinite query that is executed and the scrolling fetched all the pages. Now when the component is unmounted and mounted again, the data is loaded from the cache but the background refetching happens even though
refetchOnMount
is set tofalse
.This issue can be reproduced with the same code: https://codesandbox.io/s/fervent-ives-6v9gk
Forked the 'Load More | Infinite Scroll' and added the
refetchOnMount: false
.Steps to repro:
Check the network tab to see that the queries are refetched.
Beta Was this translation helpful? Give feedback.
All reactions