Skip to content
Discussion options

You must be logged in to vote

there is only one request ;)

  • remove only removes the query from the cache and doesn't inform observers.
  • refetch then refetches it, giving you a clean loading state

alternatively, you could also use queryClient.resetQueries(key). It will reset the query to its initial state and refetch. I have an open PR to add a reset method to return it from useQuery, but I haven't really seen enough use-cases yet to actually add it. Maybe this is it?

anyways, why you are seeing two requests is likely because of refetchOnWindowFocus:

  • you open the page
  • you open the console and switch to the network tab to inspect how many requests there are
  • you click the refetch button

--> but because you have the net…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@denisborovikov
Comment options

Answer selected by denisborovikov
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