-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Description
Describe the bug
v5.85.2 introduced a breaking change while using StrictMode
impacting state of isLoading
and isFetching
On initial load state of isLoading
doesn't reflect described API behaviour, API states that isLoading
reflects the state of the first fetch, not subsequent fetches. However with StrictMode
enabled isLoading
reverts to false
before the first request finishes
Example: https://stackblitz.com/edit/tanstack-query-2c4dbawu?file=src%2Findex.tsx
Example above updates DOM as request state changes: req1: isLoading:false, state: success, fetching: false data: request 1, time=1755607826585
. time=
is added when request is finished
Your minimal, reproducible example
https://stackblitz.com/edit/tanstack-query-2c4dbawu?file=src%2Findex.tsx
Steps to reproduce
- On initial load observe that
isLoading: true
,state: pending
andfetching: false
- Observe
isLoading
quickly changes tofalse
butstate
remainspending
.
Before v5.85.2
isLoading
would remain true until first request completes. If StrictMode
is removed isLoading
behaves as expected
Downgrade to 5.85.0 npm install @tanstack/[email protected] @tanstack/[email protected]
and run the example again npm run dev
and observe isLoading
behaves as expected.
Expected behavior
At first load isLoading
and isFetching
should reflect the status
of the first request.
How often does this bug happen?
Every time
Screenshots or Videos
Screen.Recording.2025-08-19.at.15.32.13.mov
Platform
- OS: macOS
- Browser: Chrome
- Version: 5.85.2
Tanstack Query adapter
None
TanStack Query version
5.85.2
TypeScript version
No response
Additional context
No response