Describe the bug
This is similar to an old bug: #3642
But now this only happens, if the disabled query isn't actively rendered anymore and TanStack Query still has it in the cache.
Then the query will be executed even though it was never enabled.
Your minimal, reproducible example
https://codesandbox.io/p/sandbox/brave-khayyam-62yx75
Steps to reproduce
In the CodeSandbox you have a button to invaldate the Query and another button to toggle if the query is being actively rendered.
If it's not actively being rendered, you can see that the queries get fetched on invalidation even though it was always disabled.
Expected behavior
Disabled queries shouldn't be fetched on invalidateQueries when they never were enabled in the first place.
How often does this bug happen?
Every time
Screenshots or Videos
https://share.cleanshot.com/Msh4Bk4q
Platform
- OS: macOS
- Browser: Arc (Chrome)
- Version: 1.61.2 (54148) (Chromium Engine Version 129.0.6668.71)
Tanstack Query adapter
react-query
TanStack Query version
v5.56.2
TypeScript version
No response
Additional context
No response
Describe the bug
This is similar to an old bug: #3642
But now this only happens, if the disabled query isn't actively rendered anymore and TanStack Query still has it in the cache.
Then the query will be executed even though it was never enabled.
Your minimal, reproducible example
https://codesandbox.io/p/sandbox/brave-khayyam-62yx75
Steps to reproduce
In the CodeSandbox you have a button to invaldate the Query and another button to toggle if the query is being actively rendered.
If it's not actively being rendered, you can see that the queries get fetched on invalidation even though it was always disabled.
Expected behavior
Disabled queries shouldn't be fetched on
invalidateQuerieswhen they never were enabled in the first place.How often does this bug happen?
Every time
Screenshots or Videos
https://share.cleanshot.com/Msh4Bk4q
Platform
Tanstack Query adapter
react-query
TanStack Query version
v5.56.2
TypeScript version
No response
Additional context
No response