Skip to content

test(vue-query): add regression tests for suspense release on programmatic 'setQueryData' - #11249

Merged
sukvvon merged 1 commit into
mainfrom
test/vue-query-suspense-set-query-data
Aug 22, 2026
Merged

test(vue-query): add regression tests for suspense release on programmatic 'setQueryData'#11249
sukvvon merged 1 commit into
mainfrom
test/vue-query-suspense-set-query-data

Conversation

@sukvvon

@sukvvon sukvvon commented Aug 22, 2026

Copy link
Copy Markdown
Member

🎯 Changes

Port the vue-query counterpart of the regression tests added in #11036 (react-query). The underlying fix lives in packages/query-core/src/queryObserver.ts (fetchOptimistic), and vue-query's .suspense() helper (useBaseQuery.ts) calls observer.fetchOptimistic(...) directly, so it already gets the runtime behavior for free — this PR only adds test coverage:

  • should release suspense when setQueryData is called while fetch is in-flight
  • should release suspense when streamedQuery receives first chunk

Two scenarios from the react-query version were deliberately not ported:

  • "setQueryData before component mounts": in vue-query, .suspense() only calls fetchOptimistic when optimisticResult.isStale is true; with data already cached and fresh, it resolves via a different branch and never reaches the fixed code path, so the test would pass regardless of the fix.
  • "should NOT release suspense when setQueryData is called with undefined": verified locally that this assertion still passed even with the query.state.data !== undefined guard removed from fetchOptimistic, i.e. it doesn't actually exercise the guard in vue's .suspense() shape. Left out rather than shipping a test that doesn't test anything.

Both included tests were verified against a reverted (pre-#11036) fetchOptimistic locally and failed as expected (timeout) before being confirmed passing against the current code.

✅ 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 coverage for suspense behavior after query data updates.
    • Added coverage for suspense resolution when streamed queries receive their first data chunk.

@nx-cloud

nx-cloud Bot commented Aug 22, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit b019312

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

☁️ Nx Cloud last updated this comment at 2026-08-22 02:47:13 UTC

@coderabbitai

coderabbitai Bot commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 0e5634b0-150a-4364-b8ae-450d34892036

📥 Commits

Reviewing files that changed from the base of the PR and between abd81f4 and b019312.

📒 Files selected for processing (1)
  • packages/vue-query/src/__tests__/suspense.test.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review.


📝 Walkthrough

Walkthrough

Added Vue suspense tests that use Vitest fake timers. The tests verify resolution after setQueryData updates an in-flight query and after experimental_streamedQuery yields its first chunk.

Changes

Vue suspense behavior

Layer / File(s) Summary
Suspense resolution tests
packages/vue-query/src/__tests__/suspense.test.ts
Added fake-timer setup and cleanup. Added tests for suspense resolution after setQueryData and after the first streamed query chunk.

Estimated code review effort: 3 (Moderate) | ~15 minutes

Merge Risk: ⚪ Minimal · up to b0193

This PR adds localized regression coverage without changing published runtime behavior, and no actionable merge-blocking risk remains beyond normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description check ✅ Passed The description explains the test scope, motivation, validation, checklist status, and release impact.
Title check ✅ Passed The title clearly identifies the Vue Query suspense regression tests for programmatic setQueryData updates.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/vue-query-suspense-set-query-data

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.

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

10 package(s) bumped directly, 15 bumped as dependents.

🟨 Minor bumps

Package Version Reason
@tanstack/angular-query-experimental 5.101.4 → 5.102.0 Changeset
@tanstack/eslint-plugin-query 5.101.4 → 5.102.0 Changeset
@tanstack/preact-query 5.101.4 → 5.102.0 Changeset
@tanstack/query-broadcast-client-experimental 5.101.4 → 5.102.0 Changeset
@tanstack/query-core 5.101.4 → 5.102.0 Changeset
@tanstack/react-query 5.101.4 → 5.102.0 Changeset
@tanstack/solid-query 5.101.4 → 5.102.0 Changeset
@tanstack/vue-query 5.101.4 → 5.102.0 Changeset
@tanstack/angular-query-persist-client 5.101.4 → 5.102.0 Dependent
@tanstack/preact-query-devtools 5.101.4 → 5.102.0 Dependent
@tanstack/preact-query-persist-client 5.101.4 → 5.102.0 Dependent
@tanstack/query-async-storage-persister 5.101.4 → 5.102.0 Dependent
@tanstack/query-devtools 5.101.4 → 5.102.0 Dependent
@tanstack/query-persist-client-core 5.101.4 → 5.102.0 Dependent
@tanstack/query-sync-storage-persister 5.101.4 → 5.102.0 Dependent
@tanstack/react-query-devtools 5.101.4 → 5.102.0 Dependent
@tanstack/react-query-next-experimental 5.101.4 → 5.102.0 Dependent
@tanstack/react-query-persist-client 5.101.4 → 5.102.0 Dependent
@tanstack/solid-query-devtools 5.101.4 → 5.102.0 Dependent
@tanstack/solid-query-persist-client 5.101.4 → 5.102.0 Dependent

🟩 Patch bumps

Package Version Reason
@tanstack/lit-query 0.2.11 → 0.2.12 Changeset
@tanstack/svelte-query 6.1.38 → 6.1.39 Changeset
@tanstack/svelte-query-devtools 6.1.38 → 6.1.39 Dependent
@tanstack/svelte-query-persist-client 6.1.38 → 6.1.39 Dependent
@tanstack/vue-query-devtools 6.1.38 → 6.1.39 Dependent

@pkg-pr-new

pkg-pr-new Bot commented Aug 22, 2026

Copy link
Copy Markdown
More templates

@tanstack/angular-query-experimental

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

@tanstack/eslint-plugin-query

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

@tanstack/lit-query

npm i https://pkg.pr.new/@tanstack/lit-query@11249

@tanstack/preact-query

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

@tanstack/preact-query-devtools

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

@tanstack/preact-query-persist-client

npm i https://pkg.pr.new/@tanstack/preact-query-persist-client@11249

@tanstack/query-async-storage-persister

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

@tanstack/query-broadcast-client-experimental

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

@tanstack/query-core

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

@tanstack/query-devtools

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

@tanstack/query-persist-client-core

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

@tanstack/query-sync-storage-persister

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

@tanstack/react-query

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

@tanstack/react-query-devtools

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

@tanstack/react-query-next-experimental

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

@tanstack/react-query-persist-client

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

@tanstack/solid-query

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

@tanstack/solid-query-devtools

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

@tanstack/solid-query-persist-client

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

@tanstack/svelte-query

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

@tanstack/svelte-query-devtools

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

@tanstack/svelte-query-persist-client

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

@tanstack/vue-query

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

@tanstack/vue-query-devtools

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

commit: b019312

@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size
react full 11.98 KB (0%)
react minimal 8.92 KB (0%)

@sukvvon
sukvvon merged commit eeb9820 into main Aug 22, 2026
9 checks passed
@sukvvon
sukvvon deleted the test/vue-query-suspense-set-query-data branch August 22, 2026 02:48
@sukvvon sukvvon self-assigned this Aug 22, 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.

1 participant