[Angular query] Queries with enabled: false have their fields not behaving as expected #8545
Labels
documentation
Improvements or additions to documentation
package: angular-query
package: angular-query-experimental
Describe the bug
When setting a query with
enabled: false
and callingquery.refetch()
in thengOnInit
life cycle callback, many of the fields of the query behave abnormally.For exemple, the
isFetching
signal andisLoading
signal will have their value set tofalse
even if the query is fetching.The
isFetching
andisLoading
signals will be set to true only on a retry of the query.Also, if the query results in an error, the next time the
ngOnInit
callsquery.refetch()
the query's error will not be reset tonull
, it will only be set to null if there is a retry of the query.I imagine that there are some other weird things happening not listed here.
Your minimal, reproducible example
https://codesandbox.io/p/devbox/angular-query-enabled-bug-fnslsy
Steps to reproduce
Click on the reproduction URL and I guess it should be sufficient to see the issue. I'm not sure how
codesandbox
work :/Expected behavior
The
isFetching
andisLoading
signals should be set to true right after calling.refetch
. During a refetch, theerror
signal should be set to null.How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
Tanstack Query adapter
angular-query
TanStack Query version
v5.64.1
TypeScript version
v5.7.3
Additional context
No response
The text was updated successfully, but these errors were encountered: