Skip to content

[Angular query] Queries with enabled: false have their fields not behaving as expected #8545

Closed
@JulienLecoq

Description

@JulienLecoq

Describe the bug

When setting a query with enabled: false and calling query.refetch() in the ngOnInit life cycle callback, many of the fields of the query behave abnormally.

For exemple, the isFetching signal and isLoading signal will have their value set to false even if the query is fetching.

The isFetching and isLoading 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 calls query.refetch() the query's error will not be reset to null, 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 and isLoading signals should be set to true right after calling .refetch. During a refetch, the error signal should be set to null.

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

  • OS: macOS
  • Browser: Safari

Tanstack Query adapter

angular-query

TanStack Query version

v5.64.1

TypeScript version

v5.7.3

Additional context

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions