Closed as not planned
Description
Describe the bug
When a query is disabled (i.e. enabled: false), TanStack Query still serves previously cached data and labels it as “fresh".
Your minimal, reproducible example
https://codesandbox.io/p/devbox/loving-perlman-jw78wf?workspaceId=ws_QheumUjeu5qT8HgBCqBQ98
Steps to reproduce
- Open the demo via the provided link:
- Click Mount → see “Query Data: No data”.
- Click Enable Query → see “Query Data: {current timestamp}”.
- Verify in DevTools → query is in stale state.
- Click Unmount, then Mount again (query will disabled again).
- Observe “Query Data: {old timestamp}”.
- In DevTools → Status: disabled, Data status: fresh.
Expected behavior
With enabled: false, the component should either:
- Render no data (undefined/null)
or - If cached data persists, it should be marked as stale, not fresh.
In DevTools, a disabled query with outdated cache should show Status: disabled and Data status: stale.
How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
- OS: all
- Browser: all
Tanstack Query adapter
None
TanStack Query version
5.76.1
TypeScript version
No response
Additional context
No response
Metadata
Metadata
Assignees
Labels
No labels