Skip to content

test(solid-query/useInfiniteQuery): add type tests for page params, 'initialData', 'select', and 'Accessor<QueryClient>'#10496

Merged
sukvvon merged 1 commit intomainfrom
test/solid-query-useInfiniteQuery-type-tests
Apr 14, 2026
Merged

test(solid-query/useInfiniteQuery): add type tests for page params, 'initialData', 'select', and 'Accessor<QueryClient>'#10496
sukvvon merged 1 commit intomainfrom
test/solid-query-useInfiniteQuery-type-tests

Conversation

@sukvvon
Copy link
Copy Markdown
Collaborator

@sukvvon sukvvon commented Apr 14, 2026

🎯 Changes

Add type tests for useInfiniteQuery in solid-query, covering:

  • pageParam and direction type inference in queryFn
  • fetchInfiniteQuery / prefetchInfiniteQuery page param types
  • initialData overload (DefinedUseInfiniteQueryResult vs UseInfiniteQueryResult)
  • select data transformation
  • getNextPageParam / getPreviousPageParam typed params
  • Error booleans (isFetchNextPageError, isFetchPreviousPageError, isLoadingError, isRefetchError)
  • Accessor<QueryClient> second argument

✅ 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 comprehensive type-checking tests for the useInfiniteQuery hook to validate type inference across pagination scenarios, data initialization, error states, and custom query client configurations.

…initialData', 'select', and 'Accessor<QueryClient>'
@nx-cloud
Copy link
Copy Markdown

nx-cloud bot commented Apr 14, 2026

View your CI Pipeline Execution ↗ for commit d0bc2d3

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

☁️ Nx Cloud last updated this comment at 2026-04-14 12:14:14 UTC

@github-actions
Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

No changeset entries found. Merging this PR will not cause a version bump for any packages.

@sukvvon sukvvon self-assigned this Apr 14, 2026
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 14, 2026

More templates

@tanstack/angular-query-experimental

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

@tanstack/eslint-plugin-query

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

@tanstack/preact-query

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

@tanstack/preact-query-devtools

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

@tanstack/preact-query-persist-client

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

@tanstack/query-async-storage-persister

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

@tanstack/query-broadcast-client-experimental

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

@tanstack/query-core

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

@tanstack/query-devtools

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

@tanstack/query-persist-client-core

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

@tanstack/query-sync-storage-persister

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

@tanstack/react-query

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

@tanstack/react-query-devtools

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

@tanstack/react-query-next-experimental

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

@tanstack/react-query-persist-client

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

@tanstack/solid-query

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

@tanstack/solid-query-devtools

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

@tanstack/solid-query-persist-client

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

@tanstack/svelte-query

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

@tanstack/svelte-query-devtools

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

@tanstack/svelte-query-persist-client

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

@tanstack/vue-query

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

@tanstack/vue-query-devtools

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

commit: d0bc2d3

@github-actions
Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size
react full 11.99 KB (0%)
react minimal 9.02 KB (0%)

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 14, 2026

📝 Walkthrough

Walkthrough

A new TypeScript type test file was added for useInfiniteQuery, containing compile-time assertions that verify the correct typing of various features including initialPageParam, direction, initialData, select, pagination callbacks, and error states.

Changes

Cohort / File(s) Summary
Type Test Suite
packages/solid-query/src/__tests__/useInfiniteQuery.test-d.tsx
Added comprehensive TypeScript type assertions for useInfiniteQuery, verifying correct typing of initialPageParam, direction, initialData, select, pagination callbacks, error states, and custom QueryClient support.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

Poem

🐰 Hopping through types with infinite cheer,
Type-safe pagination, crystal and clear!
Pages and params, all properly bound,
Where TypeScript and query together are found.
A test-warren built on assertions so true! 🎉

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: adding type tests for useInfiniteQuery covering page params, initialData, select, and Accessor support.
Description check ✅ Passed The description follows the required template with all sections present: detailed Changes section listing covered areas, completed Checklist, and Release Impact marked appropriately as dev-only.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ 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/solid-query-useInfiniteQuery-type-tests

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

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
packages/solid-query/src/__tests__/useInfiniteQuery.test-d.tsx (1)

96-97: Consider linking TODOs to a tracked issue for the pageParams generic-order limitation.

This makes the known typing gap easier to prioritize and prevents TODOs from becoming stale.

📝 Minimal follow-up tweak
- // TODO: Order of generics prevents pageParams to be typed correctly. Using `unknown` for now
+ // TODO(#<issue-id>): Order of generics prevents pageParams from being typed correctly. Using `unknown` for now

Also applies to: 154-155, 200-201

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/solid-query/src/__tests__/useInfiniteQuery.test-d.tsx` around lines
96 - 97, Replace the bare TODO about the pageParams generic-order typing gap
with a linked TODO that references a tracked issue (e.g., "TODO: link to issue
`#NNN`" or a full issue URL) so it’s discoverable; update the comment near the
infiniteQuery usage (reference symbol infiniteQuery and the pageParams generic)
and apply the same change to the other occurrences mentioned (the TODOs at the
other two locations) so all TODOs consistently point to the single tracker
issue.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@packages/solid-query/src/__tests__/useInfiniteQuery.test-d.tsx`:
- Around line 96-97: Replace the bare TODO about the pageParams generic-order
typing gap with a linked TODO that references a tracked issue (e.g., "TODO: link
to issue `#NNN`" or a full issue URL) so it’s discoverable; update the comment
near the infiniteQuery usage (reference symbol infiniteQuery and the pageParams
generic) and apply the same change to the other occurrences mentioned (the TODOs
at the other two locations) so all TODOs consistently point to the single
tracker issue.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 43f214fa-5580-4600-af69-a8793a386c4c

📥 Commits

Reviewing files that changed from the base of the PR and between 2e144da and d0bc2d3.

📒 Files selected for processing (1)
  • packages/solid-query/src/__tests__/useInfiniteQuery.test-d.tsx

@sukvvon sukvvon merged commit 7a3bf31 into main Apr 14, 2026
10 checks passed
@sukvvon sukvvon deleted the test/solid-query-useInfiniteQuery-type-tests branch April 14, 2026 12:20
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