query: refetch does not respect enabled false
Describe the bug
~Is it possible that this (#1797) has regressed? I’m on ^3.12.1 and running into exactly this.~
When calling refetch, there does not seem to be a way to respect enabled. Manually refetching the query always goes through. This by itself is not an issue, but that means that the only way to use a refetch-but-respect-query-options is to:
- use
queryClientdirectly - copy the
enabledlogic and execute it before callingrefetch
When the refetch is in flight, it will actually keep retrying the query too if the query fails. This can be overcome by copying the enabled logic once more to the retry function.
Expected behavior
There is a way to refetchIfEnabled.
Perhaps this can be added to the optional options of refetch as a flag?
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 20
just trying to make suggestions. Like I said, I would architect it differently: