Closed aahahocevar closed 2 weeks ago
the query status has 3 values:
success
: data was fetched successfullyerror
: there was an errorpending
: we don't have data yet (for whatever reason)when a background refetch occurs, the status
does not go back to pending
. That is per design. Have a look at the fetchStatus
for your needs.
Describe the bug
First of all, I want to thank you for your great work with this library!
In the following code, when clicking on the "Toggle" button the query will be executed correctly and the status value will change as expected, when deactivating the query and activating it again, the status does not change, always remaining in "success" even though the function
queryFn
is executed again:Your minimal, reproducible example
https://codesandbox.io/p/sandbox/possiblereactquerybug-xrmgql
Steps to reproduce
Expected behavior
I think that the value of q.status should change to "pending" and then to "success" if the query was successful every time queryFn is executed
How often does this bug happen?
Every time
Screenshots or Videos
Platform
Tanstack Query adapter
None
TanStack Query version
v5.29.2
TypeScript version
v5.4.5
Additional context
No response