Skip to content

chore: use infiniteQuery instead of fetchInfiniteQuery et al - #11344

Merged
TkDodo merged 2 commits into
TanStack:mainfrom
DogPawHat:simplifed-query-methods/internal-tests-inifinite
Aug 31, 2026
Merged

chore: use infiniteQuery instead of fetchInfiniteQuery et al#11344
TkDodo merged 2 commits into
TanStack:mainfrom
DogPawHat:simplifed-query-methods/internal-tests-inifinite

Conversation

@DogPawHat

@DogPawHat DogPawHat commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

🎯 Changes

infiniteQuery version of #11340

✅ 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 infinite-query SSR, hydration, and prefetch coverage to use the unified infinite-query API.
    • Preserved existing query options, caching behavior, assertions, and hydration scenarios.
    • Added safe handling for rejected asynchronous query operations in test scenarios.
@coderabbitai

coderabbitai Bot commented Aug 31, 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: ac563bc8-c1aa-43ae-905a-d26df49f2a09

📥 Commits

Reviewing files that changed from the base of the PR and between dfae30f and e976c33.

📒 Files selected for processing (1)
  • packages/query-core/src/__tests__/hydration.test.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/query-core/src/tests/hydration.test.tsx

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


📝 Walkthrough

Walkthrough

The tests replace prefetchInfiniteQuery and fetchInfiniteQuery calls with the unified infiniteQuery API. Prefetch-style calls attach .catch(noop) to handle rejected promises. Query options and assertions remain unchanged.

Changes

Infinite query test updates

Layer / File(s) Summary
Framework test API migration
packages/preact-query/src/__tests__/*, packages/react-query/src/__tests__/*
Preact and React tests use infiniteQuery for SSR and populated-cache scenarios. The tests import and use noop for rejected promises.
Hydration test API migration
packages/query-core/src/__tests__/hydration.test.tsx
Hydration tests use infiniteQuery for server prefetch and client fetch operations. Prefetch-style calls attach .catch(noop).

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

Merge Risk: ⚪ Minimal · up to e976c

This PR updates internal tests to use the infinite-query API; no actionable merge-blocking risk remains beyond normal checks and review.

🚥 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 2 functions across 5 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: replacing fetchInfiniteQuery and related methods with infiniteQuery in tests.
Description check ✅ Passed The description includes all required sections, completed checklist items, and the correct release-impact classification. The change summary is brief but sufficient in context.
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.
  • 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.

@nx-cloud

nx-cloud Bot commented Aug 31, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit e976c33

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

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

@DogPawHat

DogPawHat commented Aug 31, 2026

Copy link
Copy Markdown
Contributor Author

@TkDodo once this and #11345 are merged, I think a 'no-restricted-properties' lint rule for the tests on the old methods might be helpful to keep them out of new tests.

@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@11344

@tanstack/eslint-plugin-query

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

@tanstack/lit-query

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

@tanstack/preact-query

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

@tanstack/preact-query-devtools

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

@tanstack/preact-query-persist-client

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

@tanstack/query-async-storage-persister

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

@tanstack/query-broadcast-client-experimental

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

@tanstack/query-core

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

@tanstack/query-devtools

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

@tanstack/query-persist-client-core

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

@tanstack/query-sync-storage-persister

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

@tanstack/react-query

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

@tanstack/react-query-devtools

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

@tanstack/react-query-next-experimental

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

@tanstack/react-query-persist-client

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

@tanstack/solid-query

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

@tanstack/solid-query-devtools

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

@tanstack/solid-query-persist-client

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

@tanstack/svelte-query

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

@tanstack/svelte-query-devtools

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

@tanstack/svelte-query-persist-client

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

@tanstack/vue-query

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

@tanstack/vue-query-devtools

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

commit: e976c33

@TkDodo
TkDodo merged commit 1566c16 into TanStack:main Aug 31, 2026
9 checks passed
@DogPawHat
DogPawHat deleted the simplifed-query-methods/internal-tests-inifinite branch August 31, 2026 12:10
@TkDodo

TkDodo commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator

@TkDodo once this and #11344 are merged, I think a 'no-restricted-properties' lint rule for the tests on the old methods might be helpful to keep them out of new tests.

good idea!

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

Labels

None yet

2 participants