Describe the bug#
When the complete button is pressed, the query is disabled and getTodo is not executed when it should be fetching data again in the background. (Check out codesandbox!)
Your minimal, reproducible example#
codesandbox
Steps to reproduce#
1 Click on the complete button
2 Please check the console in DevTools
Expected behavior#
I want the following console log to be displayed when the complete button is pressed.
If the query is currently being rendered via useQuery or related hooks, it will also be refetched in the background
https://tanstack.com/query/latest/docs/framework/react/guides/query-invalidation
------------------------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
How often does this bug happen?#
Every time
Screenshots or Videos#
https://github.com/TanStack/query/assets/95360878/ab7e6b5b-a08d-4dfc-933a-7fbabe9bc140
Platform#
N/A
Tanstack Query adapter#
react-query
TanStack Query version#
v5.28.6
TypeScript version#
v4.4.4
Additional context#
No response
you're not importing
getTodoQueryKeyin the file that executes the mutation. The TypeScript error you see is in your sandbox is there for a reason ...https://codesandbox.io/p/sandbox/usesuspensequery-refetch-example-forked-8fwz68?file=%2Fsrc%2FTodo%2Fuse-complite-todo.ts%3A4%2C26