Skip to content

fix(query-core): honour fetchStatus filters in isFetching - #12281

Closed
vkpdeveloper wants to merge 1 commit into
TanStack:mainfrom
vkpdeveloper:fix/honour-isfetching-fetchstatus-filter
Closed

vkpdeveloper wants to merge 1 commit into
TanStack:mainfrom
vkpdeveloper:fix/honour-isfetching-fetchstatus-filter

Conversation

@vkpdeveloper

@vkpdeveloper vkpdeveloper commented Oct 22, 2026 •

Copy link
Copy Markdown

🎯 Changes

Fixes #11984

QueryClient.isFetching spreads the caller's filters and then always sets fetchStatus: 'fetching', so passing fetchStatus: 'paused' or 'idle' is ignored. It now uses the given fetchStatus and falls back to 'fetching' only when none is given, so default counts don't change. useIsFetching in every adapter just forwards filters, so they get the fix too; their doc comments and the generated reference docs are updated to match.

New tests in queryClient.test.tsx and useIsFetching.test.tsx fail without the fix (paused count 0 instead of 1) and pass with it. test:pr passes except the Preact example typecheck, which fails on its own built dist folder and passes once that folder is removed.

AI use: the code was written by gpt-6-astra (xhigh) in Codex CLI, and this description with Claude Code (Opus 5.5).

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested code changes locally with pnpm run test:pr, or these tests do not apply to this pull request.
  • I have followed the AI contribution policy and fully understand the code in this pull request, including any code generated with AI assistance.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Fetching counters can now count queries by status: fetching (the default), paused, or idle.
    • Apply other query filters alongside a fetch status to narrow the count.
  • Documentation

    • Updated API references across frameworks to explain the default status and how to count queries in other statuses.

@changeset-bot

changeset-bot Bot commented Oct 22, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 8a05d5a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 24 packages
Name Type
@tanstack/query-core Patch
@tanstack/angular-query-experimental Patch
@tanstack/lit-query Patch
@tanstack/preact-query Patch
@tanstack/query-async-storage-persister Patch
@tanstack/query-broadcast-client-experimental Patch
@tanstack/query-devtools Patch
@tanstack/query-persist-client-core Patch
@tanstack/query-sync-storage-persister Patch
@tanstack/react-query Patch
@tanstack/solid-query Patch
@tanstack/svelte-query Patch
@tanstack/vue-query Patch
@tanstack/preact-query-devtools Patch
@tanstack/preact-query-persist-client Patch
@tanstack/react-query-devtools Patch
@tanstack/solid-query-devtools Patch
@tanstack/svelte-query-devtools Patch
@tanstack/vue-query-devtools Patch
@tanstack/react-query-persist-client Patch
@tanstack/solid-query-persist-client Patch
@tanstack/svelte-query-persist-client Patch
@tanstack/react-query-next-experimental Patch
@tanstack/eslint-plugin-query Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
📥 Commits

Reviewing files that changed from the base of the PR and between 84332de and 8a05d5a.

📒 Files selected for processing: 26
  • .changeset/great-ghosts-ring.md
  • docs/framework/angular/reference/classes/QueryClient.md
  • docs/framework/angular/reference/functions/injectIsFetching.md
  • docs/framework/lit/reference/classes/QueryClient.md
  • docs/framework/lit/reference/functions/useIsFetching.md
  • docs/framework/lit/reference/type-aliases/IsFetchingAccessor.md
  • docs/framework/preact/reference/classes/QueryClient.md
  • docs/framework/preact/reference/functions/useIsFetching.md
  • docs/framework/react/reference/classes/QueryClient.md
  • docs/framework/react/reference/functions/useIsFetching.md
  • docs/framework/solid/reference/classes/QueryClient.md
  • docs/framework/solid/reference/functions/useIsFetching.md
  • docs/framework/svelte/reference/classes/QueryClient.md
  • docs/framework/svelte/reference/functions/useIsFetching.md
  • docs/framework/vue/reference/classes/QueryClient.md
  • docs/framework/vue/reference/functions/useIsFetching.md
  • packages/angular-query-experimental/src/inject-is-fetching.ts
  • packages/lit-query/src/useIsFetching.ts
  • packages/preact-query/src/useIsFetching.ts
  • packages/query-core/src/__tests__/queryClient.test.tsx
  • packages/query-core/src/queryClient.ts
  • packages/react-query/src/__tests__/useIsFetching.test.tsx
  • packages/react-query/src/useIsFetching.ts
  • packages/solid-query/src/useIsFetching.ts
  • packages/svelte-query/src/useIsFetching.svelte.ts
  • packages/vue-query/src/useIsFetching.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

📝 Walkthrough

QueryClient.isFetching now honors a supplied fetchStatus filter and defaults nullish values to 'fetching'. Tests cover the status filters and their combination with query filters. Framework documentation describes the same defaults and alternatives.

Changes: Fetch-status filtering

Layer / File(s) Summary
Core filtering and tests
packages/query-core/src/queryClient.ts, packages/query-core/src/__tests__/queryClient.test.tsx, packages/react-query/src/__tests__/useIsFetching.test.tsx, .changeset/great-ghosts-ring.md
QueryClient.isFetching now uses a non-nullish fetchStatus filter or defaults to 'fetching'. Tests cover fetching, paused, and idle statuses, additional query filters, and the default for omitted or undefined values.
Framework fetching-counter documentation
packages/*-query/src/useIsFetching*, packages/angular-query-experimental/src/inject-is-fetching.ts, docs/framework/*/reference/functions/*IsFetching.md, docs/framework/lit/reference/type-aliases/IsFetchingAccessor.md
Framework API documentation describes the default 'fetching' status, the 'paused' and 'idle' alternatives, and counts based on the requested status.
QueryClient reference pages
docs/framework/*/reference/classes/QueryClient.md
The generated references describe isFetching status filtering and update documented source links.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~12 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: sukvvon

Merge Risk: ⚪ Minimal · up to 8a05d

The fetching counters are described and tested for the requested statuses; no merge-blocking issue is identified.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 10 files. (16 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: making QueryClient.isFetching honor fetchStatus filters.
Description check Passed The description explains the change, motivation, affected APIs, tests, reported test status, AI usage, checklist completion, and release impact. It follows the required template.
Linked Issues check Passed The changes satisfy #11984. QueryClient.isFetching passes the caller's fetchStatus to findAll and defaults to 'fetching' with ?? when the value is omitted or undefined. The new core tests …
Out of Scope Changes check Passed The changed files remain within #11984. The implementation, focused tests, adapter comments, generated reference updates, and the core changeset support the fetchStatus behavior or document its publ…
Full details: Linked Issues check

Explanation

The changes satisfy #11984. QueryClient.isFetching passes the caller's fetchStatus to findAll and defaults to 'fetching' with ?? when the value is omitted or undefined. The new core tests cover fetching, paused, and idle, plus query filters and default behavior. The React useIsFetching test verifies status changes. Adapter APIs already forward filters, and their source comments and generated references describe the corrected behavior.

Full details: Out of Scope Changes check

Explanation

The changed files remain within #11984. The implementation, focused tests, adapter comments, generated reference updates, and the core changeset support the fetchStatus behavior or document its public API. No unrelated product behavior is established by the supplied evidence.

Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 10 files. (16 skipped: 16 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@TkDodo TkDodo closed this Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

QueryClient.isFetching and useIsFetching accept a fetchStatus filter and ignore it

2 participants