Skip to content

test: replace 'prefetchQuery'/'fetchQuery'/'ensureQueryData' with 'query' - #11340

Merged
TkDodo merged 1 commit into
TanStack:mainfrom
DogPawHat:simplifed-query-methods/internal-tests
Aug 31, 2026
Merged

test: replace 'prefetchQuery'/'fetchQuery'/'ensureQueryData' with 'query'#11340
TkDodo merged 1 commit into
TanStack:mainfrom
DogPawHat:simplifed-query-methods/internal-tests

Conversation

@DogPawHat

@DogPawHat DogPawHat commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

🎯 Changes

Tests that used the deprecated prefetchQuery/fetchQuery/ensureQueryData methods (That did not directly test the deprecated methods themselves) refactored to use query.

This applies to where the imperative call is a side effect of the test itself. We still have the tests that test the methods directly, all of which already have equivalents for the new methods.

✅ 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 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).

Summary by CodeRabbit

  • Tests
    • Updated query, hydration, persistence, SSR, and devtools test coverage to use the unified query execution behavior.
    • Added explicit handling for expected query failures, preventing unhandled promise rejections during test runs.
    • Preserved existing test scenarios, assertions, and asynchronous behavior across supported frameworks.

@coderabbitai

coderabbitai Bot commented Aug 30, 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 19c69ab1-b34c-4cb2-a4ea-694953b07770

📥 Commits

Reviewing files that changed from the base of the PR and between fdae2ce and af5cf7e.

📒 Files selected for processing (26)
  • packages/angular-query-persist-client/src/__tests__/with-persist-query-client.test.ts
  • packages/preact-query-persist-client/src/__tests__/PersistQueryClientProvider.test.tsx
  • packages/preact-query/src/__tests__/HydrationBoundary.test.tsx
  • packages/preact-query/src/__tests__/ssr-hydration.test.tsx
  • packages/preact-query/src/__tests__/ssr.test.tsx
  • packages/preact-query/src/__tests__/usePrefetchQuery.test.tsx
  • packages/preact-query/src/__tests__/useQuery.test.tsx
  • packages/query-core/src/__tests__/hydration.test.tsx
  • packages/query-core/src/__tests__/query.test.tsx
  • packages/query-core/src/__tests__/queryCache.test.tsx
  • packages/query-core/src/__tests__/queryClient.test.tsx
  • packages/query-core/src/__tests__/queryObserver.test.tsx
  • packages/query-devtools/src/__tests__/Devtools.test.tsx
  • packages/query-sync-storage-persister/src/__tests__/storageIsFull.test.ts
  • packages/react-query-persist-client/src/__tests__/PersistQueryClientProvider.test.tsx
  • packages/react-query/src/__tests__/HydrationBoundary.test.tsx
  • packages/react-query/src/__tests__/ssr-hydration.test.tsx
  • packages/react-query/src/__tests__/ssr.test.tsx
  • packages/react-query/src/__tests__/usePrefetchQuery.test.tsx
  • packages/react-query/src/__tests__/useQuery.test.tsx
  • packages/solid-query-persist-client/src/__tests__/PersistQueryClientProvider.test.tsx
  • packages/solid-query/src/__tests__/useIsFetching.test.tsx
  • packages/solid-query/src/__tests__/useQuery.test.tsx
  • packages/svelte-query-persist-client/tests/PersistQueryClientProvider.svelte.test.ts
  • packages/svelte-query/tests/HydrationBoundary/HydrationBoundary.svelte.test.ts
  • packages/svelte-query/tests/createQuery/createQuery.svelte.test.ts

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


📝 Walkthrough

Walkthrough

The test suites replace fetchQuery and prefetchQuery setup calls with query. Tests add noop handlers for intentionally ignored rejections. Query options and assertions remain unchanged across core, framework, hydration, SSR, persistence, storage, and devtools tests.

Changes

Query API test migration

Layer / File(s) Summary
Core query and hydration behavior
packages/query-core/src/__tests__/*
Core tests use query for imperative query execution, cache updates, cancellation, observer behavior, and hydration scenarios. Rejected promises use noop where the result is intentionally ignored.
Framework query, hydration, and SSR tests
packages/angular-query-persist-client/src/__tests__/*, packages/preact-query/src/__tests__/*, packages/react-query/src/__tests__/*, packages/solid-query/src/__tests__/*, packages/svelte-query/tests/*
Framework tests replace query setup calls with query, while preserving existing query options, hydration flows, SSR behavior, and assertions.
Persistence, storage, and devtools tests
packages/*query-persist-client/src/__tests__/*, packages/svelte-query-persist-client/tests/*, packages/query-sync-storage-persister/src/__tests__/*, packages/query-devtools/src/__tests__/*
Persistence, storage, and devtools tests seed or restore cache data through query and handle returned promise rejections with noop.

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

Merge Risk: ⚪ Minimal · up to af5cf

This change updates internal tests to use the replacement query method without changing published runtime behavior; no actionable merge-blocking risk remains after normal checks and review.

Suggested reviewers: sukvvon

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ 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 32 functions across 26 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Title check ✅ Passed The title clearly identifies the test-only migration from deprecated query methods to query. It accurately summarizes the main change, although ensureQueryData is not shown in the provided file summar…
Description check ✅ Passed The description follows the required template. It explains the scope and motivation, completes the checklist, and identifies the change as development-only with no release impact.
Full details: Title check

Explanation

The title clearly identifies the test-only migration from deprecated query methods to query. It accurately summarizes the main change, although ensureQueryData is not shown in the provided file summaries.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@sukvvon sukvvon changed the title chore: move internal tests to queryClient.query test: move internal tests to 'queryClient.query' Aug 31, 2026
@sukvvon sukvvon changed the title test: move internal tests to 'queryClient.query' test: replace 'prefetchQuery'/'fetchQuery'/'ensureQueryData' with 'query' in internal tests Aug 31, 2026
@sukvvon sukvvon changed the title test: replace 'prefetchQuery'/'fetchQuery'/'ensureQueryData' with 'query' in internal tests test: replace 'prefetchQuery'/'fetchQuery'/'ensureQueryData' with 'query' Aug 31, 2026
@nx-cloud

nx-cloud Bot commented Aug 31, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit af5cf7e

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

☁️ Nx Cloud last updated this comment at 2026-08-31 00:52:09 UTC

@pkg-pr-new

pkg-pr-new Bot commented Aug 31, 2026

Copy link
Copy Markdown
More templates

@tanstack/angular-query-experimental

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

@tanstack/eslint-plugin-query

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

@tanstack/lit-query

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

@tanstack/preact-query

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

@tanstack/preact-query-devtools

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

@tanstack/preact-query-persist-client

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

@tanstack/query-async-storage-persister

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

@tanstack/query-broadcast-client-experimental

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

@tanstack/query-core

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

@tanstack/query-devtools

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

@tanstack/query-persist-client-core

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

@tanstack/query-sync-storage-persister

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

@tanstack/react-query

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

@tanstack/react-query-devtools

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

@tanstack/react-query-next-experimental

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

@tanstack/react-query-persist-client

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

@tanstack/solid-query

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

@tanstack/solid-query-devtools

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

@tanstack/solid-query-persist-client

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

@tanstack/svelte-query

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

@tanstack/svelte-query-devtools

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

@tanstack/svelte-query-persist-client

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

@tanstack/vue-query

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

@tanstack/vue-query-devtools

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

commit: af5cf7e

@TkDodo
TkDodo merged commit 6f31ef6 into TanStack:main Aug 31, 2026
9 checks passed
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.

2 participants