Repository navigation
docs(www): mark @trpc/next deprecated, point "Using Next.js" at the App Router setup - #7805
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
7 Skipped Deployments
|
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Navigation and integration guidance www/src/site.ts, www/v11/docs/client.md, www/v11/docs/client/nextjs.md |
The Next.js link now targets the App Router setup. The client documentation identifies the Pages Router integration as deprecated, describes its support status, and directs new projects to the App Router. |
Pages Router deprecation notices www/v11/docs/client/nextjs/pages-router/*, www/v11/docs/server/caching.md |
Pages Router guides display deprecation warnings and link to the TanStack React Query integration and App Router setup. The caching note specifies that it applies to the deprecated Pages Router integration. |
Estimated code review effort: 2 (Simple) | ~8 minutes
Change: Other
Possibly related issues
- trpc/trpc#7596: The promoted App Router setup guide contains examples that the issue reports use deprecated prefetch methods. This PR does not change those examples.
Possibly related PRs
- trpc/trpc#7802: Marks classic React Query as deprecated in the same Next.js documentation area.
- trpc/trpc#7804: Marks the classic
@trpc/react-queryintegration as deprecated and recommends TanStack React Query in the Pages Router documentation. - trpc/trpc#7790: Generates skills from v11 documentation that includes the Pages Router setup page.
Suggested reviewers: nick-lucas
Merge Risk: 
Minimal · up to 7bbcd
-
No concrete documentation or navigation defect was identified that blocks merging.
Pre-merge checks: 
5
-
Full details: Docstring Coverage
-
Explanation
No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 1 files. (6 skipped: 6 unsupported.)
-
Finishing Touches
-
Generate docstrings
-
- Commit to this branch
- Create a new PR
Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
|
@coderabbitai review |
Action performed
|
@trpc/client
@trpc/next
@trpc/openapi
@trpc/react-query
@trpc/server
@trpc/tanstack-react-query
@trpc/upgrade
commit: |
trpc-bot
left a comment
There was a problem hiding this comment.
Required CI is green and CodeRabbit has no open comments. Approving.
…pp Router setup Co-authored-by: alexander <[email protected]>
b411417 to
7bbcd34
Compare
|
@coderabbitai review |
Action not completed
|
…t Query deprecated (trpc#7804) <!-- CURSOR_AGENT_PR_BODY_BEGIN --> First of a stack of two, against `main`. Next: [trpc#7805](trpc#7805), `@trpc/next` marked deprecated. Merge them together. ## Why - The v11 docs starred the TanStack React Query integration, but didn't say the classic one is deprecated. - `@trpc/react-query` now only gets bug fixes, and will be removed in the next major version of tRPC. ## What v11 docs only: - TanStack React Query's sidebar label drops the ⭐️. - Classic React Query: the sidebar and title say "(Classic, deprecated)". - Every classic page now opens with a "Deprecated" warning: - bug fixes only, removed in the next major version - new projects should use `@trpc/tanstack-react-query` - a link to the migration guide - This replaces the "Classic" tip on two pages. - The TanStack React Query intro, Next.js overview and Pages Router setup say the same. ## Links - [Classic React Query](https://www-git-cursor-deprecate-classic-react-query-8095-trpc.vercel.app/docs/client/react): label and notice. - [useQuery() (classic)](https://www-git-cursor-deprecate-classic-react-query-8095-trpc.vercel.app/docs/client/react/useQuery): notice on a child page. - [TanStack React Query](https://www-git-cursor-deprecate-classic-react-query-8095-trpc.vercel.app/docs/client/tanstack-react-query): no star; intro wording. - [Next.js](https://www-git-cursor-deprecate-classic-react-query-8095-trpc.vercel.app/docs/client/nextjs#pages-router): Pages Router note. ## Screenshots Sidebar and a deprecated page, light and dark:   ## Alternatives considered - Notice on the section index only: it wouldn't show on the 14 child pages, and the docs have no Markdown partials. - A badge through the `stability` frontmatter: it shows on the page title, not the sidebar. ## Testing - `www`: `pnpm typecheck`, `pnpm lint`, `pnpm test`, `pnpm build` (with the legacy-URL check) and `pnpm check-twoslash` pass. - `pnpm format` and `pnpm validate-skills` pass. <!-- CURSOR_AGENT_PR_BODY_END --> <div><a href="https://cursor.com/agents/bc-bea99621-3942-5d29-8d59-e21921098095?cursor_ref=pr_footer&cursor_cta=open_in_web"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-web-light.png"><img alt="Open in Web" width="114" height="28" src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a> <a href="https://cursor.com/background-agent?bcId=bc-bea99621-3942-5d29-8d59-e21921098095&cursor_ref=pr_footer&cursor_cta=open_in_cursor"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img alt="Open in Cursor" width="131" height="28" src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a> </div> <!-- codesmith:footer --> --- <a href="https://app.blacksmith.sh/trpc/codesmith/trpc/pr/7804?autoLogin=true&ref=codesmith_pr_footer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/view-with-codesmith-dark-v3.svg"><source media="(prefers-color-scheme: light)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/view-with-codesmith-light-v3.svg"><img alt="View with [code]smith" src="https://pr-comments-assets.blacksmith.sh/codesmith/view-with-codesmith-dark-v3-3x.png" width="162" height="28"></picture></a> <a href="https://backend.blacksmith.sh/track/enable-autofix?expires=1796213213&installation_model_id=443568&pr_number=7804&ref=codesmith_pr_footer&repository=trpc%2Ftrpc&return_to=https%3A%2F%2Fgithub.com%2Ftrpc%2Ftrpc%2Fpull%2F7804&signature=dd3d26b27555486dc690c61063f6e20f1c156e79243c3b2df939211524b02ae0"><picture><source media="(prefers-color-scheme: dark)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-light.svg"><img alt="Autofix with [code]smith" src="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark-3x.png" width="190" height="28"></picture></a> <sup>Need help on this PR? Tag <code>@codesmith-bot</code> with what you need.</sup> <!-- codesmith:autofix:disabled --> <!-- /codesmith:footer --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **Documentation** * Clarified that the classic React Query integration is deprecated, will receive bug fixes only, and is planned for removal in the next major version. * Directed new projects to the TanStack React Query integration and provided existing projects with migration guidance. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Co-authored-by: Cursor Agent <[email protected]>
<!-- CURSOR_AGENT_PR_BODY_BEGIN --> Reverts [trpc#7805](trpc#7805) (squash commit ad46ded). [trpc#7804](trpc#7804), which deprecates classic React Query, stays. ## Why We marked `@trpc/next` deprecated too soon. Its experimental App Router exports (`nextCacheLink`, `nextHttpLink`, `.revalidate()`, and the server action handler with `useAction`) have no TanStack replacement yet, so we can't tell people to move off it. This puts the docs back as they were until a replacement exists. ## What - `git revert` of ad46ded. It applied cleanly to main. - The Pages Router pages lose their "Deprecated" notice, and the sidebar and title lose "(deprecated)". - "Using Next.js" in the top bar goes to the Next.js overview again. - The Client overview, the Next.js overview and the Response Caching tip get their old Next.js wording back. The parts from trpc#7804 about classic React Query stay. ## Links - Docs: [Pages Router setup](https://www-git-cursor-revert-trpc-next-deprecation-8095-trpc.vercel.app/docs/client/nextjs/pages-router/setup): no notice, plain label. - Docs: [SSR](https://www-git-cursor-revert-trpc-next-deprecation-8095-trpc.vercel.app/docs/client/nextjs/pages-router/ssr): no notice. - Docs: [Next.js](https://www-git-cursor-revert-trpc-next-deprecation-8095-trpc.vercel.app/docs/client/nextjs) - [Pages Router](https://www-git-cursor-revert-trpc-next-deprecation-8095-trpc.vercel.app/docs/client/nextjs#pages-router): old wording, with the classic React Query note from trpc#7804. - Docs: [Client overview](https://www-git-cursor-revert-trpc-next-deprecation-8095-trpc.vercel.app/docs/client): old Next.js sentence. - Docs: [Response Caching](https://www-git-cursor-revert-trpc-next-deprecation-8095-trpc.vercel.app/docs/server/caching): old Next.js tip. ## Alternatives considered Keep the notice but soften it. We'd still be steering people away from features they can't replace, so it's better to remove it. ## Testing - `pnpm --filter www typecheck`, `lint` and `test`, plus `pnpm format` and `pnpm validate-skills`, all pass. <!-- CURSOR_AGENT_PR_BODY_END --> <div><a href="https://cursor.com/agents/bc-bea99621-3942-5d29-8d59-e21921098095?cursor_ref=pr_footer&cursor_cta=open_in_web"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-web-light.png"><img alt="Open in Web" width="114" height="28" src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a> <a href="https://cursor.com/background-agent?bcId=bc-bea99621-3942-5d29-8d59-e21921098095&cursor_ref=pr_footer&cursor_cta=open_in_cursor"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img alt="Open in Cursor" width="131" height="28" src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a> </div> <!-- codesmith:footer --> --- <a href="https://backend.blacksmith.sh/track/enable-autofix?expires=1796234005&installation_model_id=443568&pr_number=7829&ref=codesmith_pr_footer&repository=trpc%2Ftrpc&return_to=https%3A%2F%2Fgithub.com%2Ftrpc%2Ftrpc%2Fpull%2F7829&signature=2a62d4d7019ff0e29b154e9b2857cb3181596ae6c1bc200b13f088a58f0ddef3"><picture><source media="(prefers-color-scheme: dark)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-light.svg"><img alt="Autofix with [code]smith" src="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark-3x.png" width="190" height="28"></picture></a> <sup><a href="https://app.blacksmith.sh/trpc/codesmith/trpc/pr/7829?autoLogin=true&ref=codesmith_pr_footer">Open in [code]smith</a> · Need help on this PR? Tag <code>@codesmith-bot</code> with what you need.</sup> <!-- codesmith:autofix:disabled --> <!-- /codesmith:footer --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **Documentation** * Updated Next.js guidance to distinguish the Pages Router integration from the recommended TanStack React Query integration: new projects are directed to TanStack React Query, while existing Pages Router users can find migration guidance. * Clarified that the Pages Router integration remains supported for existing projects, receives bug fixes, and is planned for removal in the next major version. * Updated related setup, SSR, SSG, aborting, and caching guidance to reflect these directions. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Co-authored-by: Cursor Agent <[email protected]>
…-query-based helpers (trpc#7830) <!-- CURSOR_AGENT_PR_BODY_BEGIN --> Follows [trpc#7829](trpc#7829), which reverted trpc#7805 and has merged. ## Why - The Next.js docs still taught `@trpc/react-query`, which only gets bug fixes and goes away in the next major. `@trpc/tanstack-react-query` works with the Pages Router too, but no page showed how. - `@trpc/next` as a whole stays: its experimental App Router helpers have no TanStack replacement yet. Only the parts built on `@trpc/react-query` are deprecated. ## What - Every Next.js page now uses `@trpc/tanstack-react-query`. Samples name their query results and use Suspense or `switch` on `status`. - Pages Router setup: a `makeQueryClient` factory, `createTRPCContext`, and `QueryClientProvider`, `TRPCProvider` and `HydrationBoundary` in `_app`. A "Using a data transformer" section runs the whole prefetched cache through superjson, because Next.js page props must be JSON, and query inputs are in the keys, not just the data. The `createTRPCNext()` options section is replaced by "Moving from `createTRPCNext`", a table of what replaces each part. - SSR: prefetch per page in `getServerSideProps` replaces `ssr: true`. It builds the context from `context.req`, verifying the session from the cookie, and sets the status and cache headers on `context.res` (with `fetchQuery` and `notFound` for a 404). Calling a separate API server is in a collapsible section. - SSG and Server-Side Helpers: `createTRPCOptionsProxy`, `prefetchQuery` and `dehydrate` instead of `createServerSideHelpers`. - Aborting: `trpc: { abortOnUnmount: true }` on each query, and a note that a batched request only stops once every query in it is cancelled. - App Router setup: two samples fixed for style. The rest already used TanStack. - Next.js overview: the Pages Router section and comparison table, plus a short deprecation note. - `@deprecated` JSDoc, linking to the replacement, on `createTRPCNext`, `withTRPC`, `ssrPrepass`, the `ssr`, `ssrPrepass` and `responseMeta` options, and their option types. - [trpc#7812](trpc#7812), now on main, also marked the `@trpc/next/app-dir/*` exports `@deprecated`. This PR removes those tags, since nothing replaces those exports yet, and keeps trpc#7812's descriptions. JSDoc links to setup anchors this PR removes now point to "Moving from `createTRPCNext`". - `@trpc/next`'s README says the same. - Outside the Next.js pages: the Response Caching tip is scoped to the Pages Router (CodeRabbit's note on trpc#7829). The Client overview's Next.js sentence is updated. `httpBatchLink` drops its `createTRPCNext` sample. The classic `useQuery` page stops linking to the removed setup anchors. ## Links - [Pages Router setup](https://www-git-cursor-next-docs-tanstack-react-query-8095-trpc.vercel.app/docs/client/nextjs/pages-router/setup) - [6. Configure `_app.tsx`](https://www-git-cursor-next-docs-tanstack-react-query-8095-trpc.vercel.app/docs/client/nextjs/pages-router/setup#6-configure-_apptsx): providers and `HydrationBoundary`. - [Using a data transformer](https://www-git-cursor-next-docs-tanstack-react-query-8095-trpc.vercel.app/docs/client/nextjs/pages-router/setup#using-a-data-transformer): superjson for the prefetched cache. - [Moving from `createTRPCNext`](https://www-git-cursor-next-docs-tanstack-react-query-8095-trpc.vercel.app/docs/client/nextjs/pages-router/setup#moving-from-createtrpcnext): new table. - [SSR](https://www-git-cursor-next-docs-tanstack-react-query-8095-trpc.vercel.app/docs/client/nextjs/pages-router/ssr) - [Prefetch in `getServerSideProps`](https://www-git-cursor-next-docs-tanstack-react-query-8095-trpc.vercel.app/docs/client/nextjs/pages-router/ssr#prefetch-in-getserversideprops): replaces `ssr: true`. - [Set the status and cache headers](https://www-git-cursor-next-docs-tanstack-react-query-8095-trpc.vercel.app/docs/client/nextjs/pages-router/ssr#set-the-status-and-cache-headers): replaces `responseMeta`. - [SSG](https://www-git-cursor-next-docs-tanstack-react-query-8095-trpc.vercel.app/docs/client/nextjs/pages-router/ssg): `getStaticProps` with superjson. - [Server-Side Helpers](https://www-git-cursor-next-docs-tanstack-react-query-8095-trpc.vercel.app/docs/client/nextjs/pages-router/server-side-helpers): `createTRPCOptionsProxy`. - [Aborting Procedure Calls](https://www-git-cursor-next-docs-tanstack-react-query-8095-trpc.vercel.app/docs/client/nextjs/pages-router/aborting-procedure-calls): per-query option. - [Next.js overview](https://www-git-cursor-next-docs-tanstack-react-query-8095-trpc.vercel.app/docs/client/nextjs#pages-router): Pages Router section and table. - [App Router setup](https://www-git-cursor-next-docs-tanstack-react-query-8095-trpc.vercel.app/docs/client/nextjs/app-router-setup#using-data-in-a-client-component): `switch` on `status`. - [Response Caching](https://www-git-cursor-next-docs-tanstack-react-query-8095-trpc.vercel.app/docs/server/caching): Pages Router tip. ## Alternatives considered - A helper that brings back `ssr: true` on top of TanStack. It would bring back a pattern the App Router has replaced, and per-page `prefetchQuery` plus `dehydrate` is only a few lines. - Deprecating all of `@trpc/next`. That's on hold until the App Router helpers have a replacement. - `serializeData` in the query client for the transformer, as the App Router setup does. It only transforms query data, so an `undefined` or `Date` in an input still fails Next.js's props check. ## Testing - Twoslash compiles every changed sample. `pnpm --filter www typecheck`, `lint` and `test` (including the package docs-link check), `pnpm format`, `pnpm validate-skills`, the root test suite, and `@trpc/next`'s typecheck and lint pass. - I ran the Pages Router pattern from the final docs in a throwaway Next.js 15 app (not committed), with `next build`, `next start` and a headless browser: - A plain page fetches in the browser. - A `getServerSideProps` page and a `getStaticProps` page, whose query input has an `undefined` field, render their data into the HTML. The superjson `Date` arrives as a `Date`, the browser sends no tRPC request, and there are no console errors. - The context reads the session from the cookie, `notFound` returns a 404, and the `cache-control` header is set. The examples that still use `createTRPCNext` aren't moved here. ## AI model Claude Opus 5.5 <!-- CURSOR_AGENT_PR_BODY_END --> <div><a href="https://cursor.com/agents/bc-bea99621-3942-5d29-8d59-e21921098095?cursor_ref=pr_footer&cursor_cta=open_in_web"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-web-light.png"><img alt="Open in Web" width="114" height="28" src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a> <a href="https://cursor.com/background-agent?bcId=bc-bea99621-3942-5d29-8d59-e21921098095&cursor_ref=pr_footer&cursor_cta=open_in_cursor"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img alt="Open in Cursor" width="131" height="28" src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a> </div> <!-- codesmith:footer --> --- <a href="https://backend.blacksmith.sh/track/enable-autofix?expires=1796234920&installation_model_id=443568&pr_number=7830&ref=codesmith_pr_footer&repository=trpc%2Ftrpc&return_to=https%3A%2F%2Fgithub.com%2Ftrpc%2Ftrpc%2Fpull%2F7830&signature=d40edf48d3ab6e4ece7440c06668fd9c9dc55c1b483bf18cf5a6014cfefcdfe2"><picture><source media="(prefers-color-scheme: dark)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-light.svg"><img alt="Autofix with [code]smith" src="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark-3x.png" width="190" height="28"></picture></a> <sup><a href="https://app.blacksmith.sh/trpc/codesmith/trpc/pr/7830?autoLogin=true&ref=codesmith_pr_footer">Open in [code]smith</a> · Need help on this PR? Tag <code>@codesmith-bot</code> with what you need.</sup> <!-- codesmith:autofix:disabled --> <!-- /codesmith:footer --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **Documentation** * Updated Next.js guidance to recommend the TanStack React Query integration for both App Router and Pages Router projects. * Added deprecation guidance for `createTRPCNext`, `withTRPC`, and automatic SSR options; experimental App Router helpers remain unaffected. * Reworked Pages Router setup, query cancellation, SSR, SSG, and server-side helper examples around per-page prefetching and cache hydration. * Expanded guidance on query cancellation, cache headers, and prefetch-versus-fetch behavior. * Improved query examples with explicit loading, error, and success states. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Cursor Agent <[email protected]>
|
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. |
Second of a stack of two, on top of #7804. Merge them together.
Why
@trpc/nextis deprecated in favor of the TanStack React Query integration.What
@trpc/nextis deprecated in favor of the TanStack React Query integration, and links to the Next.js App Router setup. No bug-fix-only or removal claim.@trpc/tanstack-react-querywith Next.js.@trpc/nextfor new projects now points to the App Router setup:Links
Screenshots
The
@trpc/nextnotice and sidebar label, light and dark:"Using Next.js" opens the App Router setup, light and dark:
Alternatives considered
None.
Testing
www:pnpm typecheck,pnpm lint,pnpm test,pnpm build(with the legacy-URL check) andpnpm check-twoslashpass.pnpm formatandpnpm validate-skillspass.Need help on this PR? Tag
@codesmith-botwith what you need.Summary by CodeRabbit