query
query copied to clipboard
isLoading is true when the query is not enabled
Describe the bug
With V3, when the query is disabled, isLoading resolves to false. Upon upgrading to V4, isLoading resolves to true when the query is disabled.
useQuery(
['key'],
() =>
API.get(`...`).then((res) => res.data)
{
enabled: false
},
);
Your minimal, reproducible example
NA
Steps to reproduce
- Create a query
- Set enabled = false
- observe isLoading value
Expected behavior
isLoading should resolve to false as the query is not enabled yet.
How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
- OS: MacOS
- Version: 4.0.10
- React Version: 17
react-query version
v4.0.10
TypeScript version
v4.7.4
Additional context
No response
has been reported before, and it's a documented breaking change.
For others who landed on this issue, here is the other thread: https://github.com/TanStack/query/issues/3975