Repository navigation
Conversation
…ching QueryClient.isFetching spread the caller's filters and then unconditionally overwrote fetchStatus with 'fetching', so a typed, documented fetchStatus filter (e.g. 'paused') type-checked but was silently discarded. useIsFetching forwards to this method, so it was affected too. QueryCache.findAll already honours the same filter correctly, which is what made the gap easy to miss. Default fetchStatus to 'fetching' only when the caller didn't pass one, matching the documented behaviour and findAll's own handling. Fixes TanStack#11984
…ching Spreading the filters after the default let an explicit `fetchStatus: undefined` override it, so isFetching counted every query. Apply the default after the spread instead.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|

Fixes #11984
QueryClient.isFetchingspread the caller's filters and then unconditionally overwrotefetchStatuswith'fetching', so a typed, documentedfetchStatusfilter (e.g.'paused') type-checked but was silently discarded.useIsFetchingforwards to this method, so it was affected too.QueryCache.findAllalready honours the same filter correctly, which is what made the gap easy to miss.This defaults
fetchStatusto'fetching'only when the caller didn't pass one, matching the documented behaviour andfindAll's own handling (resolution option 2 from the issue).fetchStatus: 'paused', then checksisFetching(),isFetching({fetchStatus:'paused'})andisFetching({fetchStatus:'idle'})all return the right counts.Checks
pnpm nx run @tanstack/query-core:test:lib— 1600/1600 passed, 0 type errorspnpm nx run @tanstack/react-query:test:lib -- useIsFetching— 5/5 passedpnpm nx affected --target=test:eslint --base=main— cleanpnpm nx affected --target=test:types --base=main— cleanSummary by CodeRabbit
QueryClient.isFetchingnow respects the supplied fetch-status filter, including paused queries. When no filter is provided, it continues to count queries that are fetching.