Skip to content

Questions about Observer and Query Invalidations #4554

Answered by TkDodo
aldy97 asked this question in General
Discussion options

You must be logged in to vote

In v4, calling invalidateQueries will, per default, cancel existing queries and re-run them.

In v3, you can do:

await queryClient.invalidateQueries({ queryKey: ['todos'] }, { cancelRefetch: true })

to achieve the same thing.

https://tanstack.com/query/v4/docs/guides/migrating-to-react-query-4#consistent-behavior-for-cancelrefetch

Replies: 1 comment 1 reply

Comment options

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

Answer selected by aldy97
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants