Skip to content

test(react-query/useSuspenseQueries): add test for suspending only pending queries when some already have cached data#10126

Open
sukvvon wants to merge 5 commits intoTanStack:mainfrom
sukvvon:test/react-query-useSuspenseQueries-partial-cached-suspend
Open

test(react-query/useSuspenseQueries): add test for suspending only pending queries when some already have cached data#10126
sukvvon wants to merge 5 commits intoTanStack:mainfrom
sukvvon:test/react-query-useSuspenseQueries-partial-cached-suspend

Conversation

@sukvvon
Copy link
Contributor

@sukvvon sukvvon commented Feb 13, 2026

🎯 Changes

Add a test to verify that useSuspenseQueries only suspends queries that are still pending, skipping queries that already have cached data via setQueryData.

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested this code locally with pnpm run test:pr.

🚀 Release Impact

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

Summary by CodeRabbit

  • Tests
    • Added test coverage for multiple concurrent queries where some have cached data while others are pending, ensuring correct suspension behavior for non-cached queries.

…nding queries when some already have cached data
@changeset-bot
Copy link

changeset-bot bot commented Feb 13, 2026

⚠️ No Changeset found

Latest commit: 9e0cf44

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 13, 2026

📝 Walkthrough

Walkthrough

Adds a test case to useSuspenseQueries verifying that when multiple queries are executed with mixed cache states—one containing cached data and one pending—only the pending query suspends while the cached query immediately returns its data.

Changes

Cohort / File(s) Summary
Test Updates
packages/react-query/src/__tests__/useSuspenseQueries.test.tsx
New test case verifying mixed cache-state behavior: when one query is cached and another is pending, only the pending query suspends while the cached query yields data immediately.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Suggested reviewers

  • TkDodo
  • manudeli

Poem

🐰 Cache meets suspend, a tale to tell,
Some data sleeps, some wakes up well,
The pending one waits in suspenseful dreams,
While cached friends return with hopeful beams.

🚥 Pre-merge checks | ✅ 2 | ❌ 2
❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Merge Conflict Detection ⚠️ Warning ❌ Merge conflicts detected (9 files):

⚔️ docs/framework/angular/guides/mutation-options.md (content)
⚔️ examples/vue/basic/package.json (content)
⚔️ examples/vue/simple/package.json (content)
⚔️ packages/react-query/src/__tests__/useSuspenseQueries.test.tsx (content)
⚔️ packages/vue-query-devtools/CHANGELOG.md (content)
⚔️ packages/vue-query-devtools/package.json (content)
⚔️ packages/vue-query-devtools/src/types.ts (content)
⚔️ pnpm-lock.yaml (content)
⚔️ tsconfig.json (content)

These conflicts must be resolved before merging into main.
Resolve conflicts locally and push changes to this branch.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding a test for useSuspenseQueries that validates behavior when some queries have cached data.
Description check ✅ Passed The description follows the template with all required sections completed, including changes, checklist items, and release impact assessment.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
⚔️ Resolve merge conflicts (beta)
  • Auto-commit resolved conflicts to branch test/react-query-useSuspenseQueries-partial-cached-suspend
  • Post resolved changes as copyable diffs in a comment

No actionable comments were generated in the recent review. 🎉


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

@nx-cloud
Copy link

nx-cloud bot commented Feb 13, 2026

View your CI Pipeline Execution ↗ for commit 9e0cf44

Command Status Duration Result
nx affected --targets=test:sherif,test:knip,tes... ✅ Succeeded 4m 21s View ↗
nx run-many --target=build --exclude=examples/*... ✅ Succeeded 1s View ↗

☁️ Nx Cloud last updated this comment at 2026-02-14 03:17:41 UTC

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 13, 2026

More templates

@tanstack/angular-query-experimental

npm i https://pkg.pr.new/@tanstack/angular-query-experimental@10126

@tanstack/eslint-plugin-query

npm i https://pkg.pr.new/@tanstack/eslint-plugin-query@10126

@tanstack/preact-query

npm i https://pkg.pr.new/@tanstack/preact-query@10126

@tanstack/query-async-storage-persister

npm i https://pkg.pr.new/@tanstack/query-async-storage-persister@10126

@tanstack/query-broadcast-client-experimental

npm i https://pkg.pr.new/@tanstack/query-broadcast-client-experimental@10126

@tanstack/query-core

npm i https://pkg.pr.new/@tanstack/query-core@10126

@tanstack/query-devtools

npm i https://pkg.pr.new/@tanstack/query-devtools@10126

@tanstack/query-persist-client-core

npm i https://pkg.pr.new/@tanstack/query-persist-client-core@10126

@tanstack/query-sync-storage-persister

npm i https://pkg.pr.new/@tanstack/query-sync-storage-persister@10126

@tanstack/react-query

npm i https://pkg.pr.new/@tanstack/react-query@10126

@tanstack/react-query-devtools

npm i https://pkg.pr.new/@tanstack/react-query-devtools@10126

@tanstack/react-query-next-experimental

npm i https://pkg.pr.new/@tanstack/react-query-next-experimental@10126

@tanstack/react-query-persist-client

npm i https://pkg.pr.new/@tanstack/react-query-persist-client@10126

@tanstack/solid-query

npm i https://pkg.pr.new/@tanstack/solid-query@10126

@tanstack/solid-query-devtools

npm i https://pkg.pr.new/@tanstack/solid-query-devtools@10126

@tanstack/solid-query-persist-client

npm i https://pkg.pr.new/@tanstack/solid-query-persist-client@10126

@tanstack/svelte-query

npm i https://pkg.pr.new/@tanstack/svelte-query@10126

@tanstack/svelte-query-devtools

npm i https://pkg.pr.new/@tanstack/svelte-query-devtools@10126

@tanstack/svelte-query-persist-client

npm i https://pkg.pr.new/@tanstack/svelte-query-persist-client@10126

@tanstack/vue-query

npm i https://pkg.pr.new/@tanstack/vue-query@10126

@tanstack/vue-query-devtools

npm i https://pkg.pr.new/@tanstack/vue-query-devtools@10126

commit: 9e0cf44

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant