Skip to content

Conversation

@bsdahl
Copy link
Contributor

@bsdahl bsdahl commented Nov 4, 2025

🎯 Changes

Adds documentation for infiniteQueryKey() and infiniteQueryFilter() under tanstack-react-query Usage page.

βœ… Checklist

  • I have followed the steps listed in the Contributing guide.
  • If necessary, I have added documentation related to the changes made.
  • I have added or updated the tests related to the changes made.

Summary by CodeRabbit

  • Documentation
    • Added guides for type-safe infinite query keys and filters with examples for querying, updating, and invalidating infinite queries.

@bsdahl bsdahl requested a review from a team as a code owner November 4, 2025 19:49
@vercel
Copy link

vercel bot commented Nov 4, 2025

@bsdahl is attempting to deploy a commit to the trpc Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 4, 2025

Walkthrough

Adds three new documentation sections to the TanStack React Query usage guide, demonstrating type-safe patterns for infinite queries: infiniteQueryKey for accessing and modifying query data, infiniteQueryFilter for creating filtered queries, and infiniteQueryFilter with predicates for invalidation logic.

Changes

Cohort / File(s) Change summary
Documentation for infinite queries
www/docs/client/tanstack-react-query/usage.mdx
Introduces three new sections documenting type-safe infinite query utilities: infiniteQueryKey with examples for getQueryData and setQueryData, infiniteQueryFilter for filter creation and invalidation, and predicate-based filter usage patterns.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

  • Documentation-only additions with no logic changes
  • Examples are illustrative without affecting production code
  • No type definitions, error handling, or API changes introduced

Poem

🐰 Infinite scrolls now have their guide,
Type-safe queries, side by side,
Filters dance with gentle grace,
Predicates find their perfect place,
Docs bloom bright in endless light! ✨

Pre-merge checks and finishing touches

βœ… Passed checks (2 passed)
Check name Status Explanation
Title check βœ… Passed The title clearly summarizes the main change: adding documentation for infiniteQueryKey and infiniteQueryFilter functions in the tanstack-react-query integration.
Description check βœ… Passed The description includes the required Changes section explaining the documentation additions and completes the checklist. It adequately documents the PR scope.
✨ Finishing touches
πŸ§ͺ Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

πŸ“œ Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between d6bb04d and e106b01.

πŸ“’ Files selected for processing (1)
  • www/docs/client/tanstack-react-query/usage.mdx (2 hunks)
🧰 Additional context used
πŸ““ Path-based instructions (1)
**/*.{ts,tsx,md,mdx}

πŸ“„ CodeRabbit inference engine (.cursor/rules/coding-guidelines.mdc)

Use camelCase for file names (with exceptions like TRPC/RPC/HTTP/JSON acronyms, .config.js, .d.ts, and tests)

Files:

  • www/docs/client/tanstack-react-query/usage.mdx
🧠 Learnings (6)
πŸ““ Common learnings
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/tanstack-react-query-tests.mdc:0-0
Timestamp: 2025-09-05T15:16:31.379Z
Learning: Applies to packages/tanstack-react-query/**/*.test.tsx : Use `ctx.useTRPC()` for TanStack React Query hooks access in components under test
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/tanstack-react-query-tests.mdc:0-0
Timestamp: 2025-09-05T15:16:31.379Z
Learning: Applies to packages/tanstack-react-query/**/*.test.tsx : Import React Query types from `tanstack/react-query` as needed
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/tanstack-react-query-tests.mdc:0-0
Timestamp: 2025-09-05T15:16:31.379Z
Learning: Applies to packages/tanstack-react-query/**/*.test.tsx : ALWAYS use `await using ctx = testReactResource(...)` to set up TanStack React Query tests
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/tanstack-react-query-tests.mdc:0-0
Timestamp: 2025-09-05T15:16:31.379Z
Learning: Applies to packages/tanstack-react-query/**/*.test.tsx : Render via `ctx.renderApp()` and rerender via `ctx.rerenderApp()` instead of custom providers
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/tanstack-react-query-tests.mdc:0-0
Timestamp: 2025-09-05T15:16:31.379Z
Learning: Applies to packages/tanstack-react-query/**/*.test.tsx : Import TanStack React Query utilities from the package source via `../src`
πŸ“š Learning: 2025-09-05T15:16:31.379Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/tanstack-react-query-tests.mdc:0-0
Timestamp: 2025-09-05T15:16:31.379Z
Learning: Applies to packages/tanstack-react-query/**/*.test.tsx : Import React Query types from `tanstack/react-query` as needed

Applied to files:

  • www/docs/client/tanstack-react-query/usage.mdx
πŸ“š Learning: 2025-09-05T15:16:01.878Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/react-query-tests.mdc:0-0
Timestamp: 2025-09-05T15:16:01.878Z
Learning: Applies to packages/react-query/**/*.test.tsx : Import createTRPCReact from 'trpc/react-query' (legacy API)

Applied to files:

  • www/docs/client/tanstack-react-query/usage.mdx
πŸ“š Learning: 2025-09-05T15:16:31.379Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/tanstack-react-query-tests.mdc:0-0
Timestamp: 2025-09-05T15:16:31.379Z
Learning: Applies to packages/tanstack-react-query/**/*.test.tsx : Use `ctx.useTRPC()` for TanStack React Query hooks access in components under test

Applied to files:

  • www/docs/client/tanstack-react-query/usage.mdx
πŸ“š Learning: 2025-09-05T15:16:31.379Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/tanstack-react-query-tests.mdc:0-0
Timestamp: 2025-09-05T15:16:31.379Z
Learning: Applies to packages/tanstack-react-query/**/*.test.tsx : Use `ctx.useTRPCClient()` for direct (vanilla) tRPC client access in tests

Applied to files:

  • www/docs/client/tanstack-react-query/usage.mdx
πŸ“š Learning: 2025-09-05T15:16:31.379Z
Learnt from: CR
Repo: trpc/trpc PR: 0
File: .cursor/rules/tanstack-react-query-tests.mdc:0-0
Timestamp: 2025-09-05T15:16:31.379Z
Learning: Applies to packages/tanstack-react-query/**/*.test.tsx : Use `ctx.optionsProxyClient` when testing client-side options proxy

Applied to files:

  • www/docs/client/tanstack-react-query/usage.mdx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: test
  • GitHub Check: typecheck
  • GitHub Check: build
  • GitHub Check: Lint and auto-fix
πŸ”‡ Additional comments (2)
www/docs/client/tanstack-react-query/usage.mdx (2)

154-182: Well-structured documentation for infiniteQueryKey.

The new section clearly explains the purpose, provides a concise usage example, and includes practical illustrations for getQueryData and setQueryData operations. The examples correctly demonstrate type-safe infinite query key access patterns consistent with existing documentation style.


215-247: Well-structured documentation for infiniteQueryFilter.

The section properly mirrors the queryFilter documentation pattern and demonstrates correct infinite query filter usage. The predicate example accessing query.state.data?.pages.length appropriately reflects infinite query specifics. The invalidateQueries example provides practical context for common use cases.


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 and usage tips.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 4, 2025

Open in StackBlitz

@trpc/client

npm i https://pkg.pr.new/trpc/trpc/@trpc/client@6995

@trpc/next

npm i https://pkg.pr.new/trpc/trpc/@trpc/next@6995

@trpc/react-query

npm i https://pkg.pr.new/trpc/trpc/@trpc/react-query@6995

@trpc/server

npm i https://pkg.pr.new/trpc/trpc/@trpc/server@6995

@trpc/tanstack-react-query

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

@trpc/upgrade

npm i https://pkg.pr.new/trpc/trpc/@trpc/upgrade@6995

commit: 642ef77

@bsdahl
Copy link
Contributor Author

bsdahl commented Dec 17, 2025

Is there anyone available to approve this PR?

This PR adds documentation for previously undocumented APIs that took several frustrating hours to uncover. This documentation will undoubtedly save others hours of frustration.

Copy link
Contributor

@Nick-Lucas Nick-Lucas left a comment

Choose a reason for hiding this comment

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

Thanks for this!

@Nick-Lucas Nick-Lucas enabled auto-merge (squash) December 18, 2025 08:58
@vercel
Copy link

vercel bot commented Dec 18, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
next-prisma-starter Ready Ready Preview Dec 18, 2025 9:02am
og-image Ready Ready Preview, Comment Dec 18, 2025 9:02am
www Ready Ready Preview, Comment Dec 18, 2025 9:02am

@github-actions
Copy link
Contributor

This pull request has been locked because we are very unlikely to see comments on closed issues. If you think, this PR is still necessary, create a new one with the same branch. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 19, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants