Skip to content

docs(www): mark @trpc/next deprecated, point "Using Next.js" at the App Router setup - #7805

Merged
KATT merged 1 commit into
cursor/deprecate-classic-react-query-8095from
cursor/deprecate-trpc-next-8095
Nov 2, 2026
Merged

KATT merged 1 commit into
cursor/deprecate-classic-react-query-8095from
cursor/deprecate-trpc-next-8095

Conversation

@KATT

@KATT KATT commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

Second of a stack of two, on top of #7804. Merge them together.

Why

  • @trpc/next is deprecated in favor of the TanStack React Query integration.
  • The top bar's "Using Next.js" went to the overview, which covers both routers.

What

  • Every Pages Router page (setup, SSR, SSG, server-side helpers, aborting calls) now opens with a "Deprecated" warning. It says @trpc/next is 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.
  • Pages Router: the sidebar and title say "(deprecated)".
  • "Using Next.js" in the top bar and phone menu now goes to Set up with Next.js App Router. It's the existing page that sets up @trpc/tanstack-react-query with Next.js.
  • Text that recommended @trpc/next for new projects now points to the App Router setup:
    • the Client overview
    • the Next.js overview: the Pages Router section and the tip
    • the Response Caching tip

Links

Screenshots

The @trpc/next notice and sidebar label, light and dark:

trpc-next-notice-light.png
trpc-next-notice-dark.png

"Using Next.js" opens the App Router setup, light and dark:

using-nextjs-light.png
using-nextjs-dark.png

Alternatives considered

None.

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.
Open in Web Open in Cursor 

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

Summary by CodeRabbit

  • Documentation
    • Updated Next.js guidance to recommend the App Router setup with TanStack React Query.
    • Marked the Pages Router integration as deprecated, clarified that it receives bug fixes only and is slated for removal in the next major version, and linked to the recommended setup across relevant guides.
    • Retained the migration guide for existing Pages Router projects.
    • Clarified that the caching note applies to the deprecated Pages Router integration.

@KATT
KATT requested a review from a team as a code owner November 2, 2026 12:06
@vercel

vercel Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
www Ready Ready Preview Nov 2, 2026 3:00pm UTC
7 Skipped Deployments
Project Deployment Actions Updated
trpc-v12 Ignored Ignored Nov 2, 2026 3:00pm UTC
examples-next-minimal-starter Skipped Skipped Nov 2, 2026 3:00pm UTC
examples-todomvc Skipped Skipped Nov 2, 2026 3:00pm UTC
next-prisma-starter Skipped Skipped Nov 2, 2026 3:00pm UTC
next-prisma-websockets-starter Skipped Skipped Nov 2, 2026 3:00pm UTC
tanstack-start-sse-chat Skipped Skipped Nov 2, 2026 3:00pm UTC
trpc-next-app-dir Skipped Skipped Nov 2, 2026 3:00pm UTC

Request Review

@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between b411417 and 7bbcd34.

Files selected for processing: 7
  • www/src/site.ts
  • www/v11/docs/client/nextjs/pages-router/aborting-procedure-calls.md
  • www/v11/docs/client/nextjs/pages-router/server-side-helpers.md
  • www/v11/docs/client/nextjs/pages-router/setup.md
  • www/v11/docs/client/nextjs/pages-router/ssg.md
  • www/v11/docs/client/nextjs/pages-router/ssr.md
  • www/v11/docs/server/caching.md
Files skipped from review as they are similar to previous changes: 5
  • www/v11/docs/client/nextjs/pages-router/ssg.md
  • www/v11/docs/server/caching.md
  • www/v11/docs/client/nextjs/pages-router/setup.md
  • www/v11/docs/client/nextjs/pages-router/ssr.md
  • www/v11/docs/client/nextjs/pages-router/server-side-helpers.md

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.

Walkthrough

The documentation and site navigation now mark the Next.js Pages Router integration, @trpc/next, as deprecated. They direct readers to the App Router setup and TanStack React Query integration.

Changes: Next.js integration deprecation

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-query integration 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: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely summarizes the main documentation changes: deprecating @trpc/next and directing users to the App Router setup.
Docstring Coverage Passed 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. Documentat…
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.
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.

Share

@trpc-bot

trpc-bot commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor
Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@pkg-pr-new

pkg-pr-new Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@trpc/client

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

@trpc/next

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

@trpc/openapi

npm i https://pkg.pr.new/@trpc/openapi@7805

@trpc/react-query

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

@trpc/server

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

@trpc/tanstack-react-query

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

@trpc/upgrade

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

commit: 7bbcd34

trpc-bot
trpc-bot previously approved these changes Nov 2, 2026

@trpc-bot trpc-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Required CI is green and CodeRabbit has no open comments. Approving.

@KATT
KATT added this pull request to the merge queue Nov 2, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue because a pull request earlier in the stack was removed Nov 2, 2026
@cursor
cursor Bot force-pushed the cursor/deprecate-trpc-next-8095 branch from b411417 to 7bbcd34 Compare November 2, 2026 14:56
@vercel
vercel Bot temporarily deployed to Preview – trpc-next-app-dir November 2, 2026 14:56 Inactive
@vercel
vercel Bot temporarily deployed to Preview – examples-todomvc November 2, 2026 14:56 Inactive
@vercel
vercel Bot temporarily deployed to Preview – next-prisma-starter November 2, 2026 14:56 Inactive
@vercel
vercel Bot temporarily deployed to Preview – examples-next-minimal-starter November 2, 2026 14:56 Inactive
@trpc-bot

trpc-bot commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor
Action not completed

Already reviewed the last commit. Use @coderabbitai full review to rerun a review of the entire changeset.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@trpc-bot trpc-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Rebased onto #7804. Required CI is green and CodeRabbit has no open comments. Approving.

@KATT
KATT added this pull request to the merge queue Nov 2, 2026
Merged via the queue into main with commit ad46ded Nov 2, 2026
53 of 54 checks passed
@KATT
KATT deleted the cursor/deprecate-trpc-next-8095 branch November 2, 2026 16:04
opensource-fork-sync Bot pushed a commit to cla7aye15I4nd/opensource-trpc__trpc that referenced this pull request Nov 2, 2026
…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:


![deprecated-page-light.png](https://cursor.com/artifacts/c/art-0ab6d941-a5cf-4920-81a8-448558a83b8f)

![deprecated-page-dark.png](https://cursor.com/artifacts/c/art-b3bf0047-df66-4147-845f-e87150d8234f)

## 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>&nbsp;<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>&nbsp;</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]>
meefs pushed a commit to meefs/trpc that referenced this pull request Nov 2, 2026
<!-- 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>&nbsp;<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>&nbsp;</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]>
meefs pushed a commit to meefs/trpc that referenced this pull request Nov 2, 2026
…-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>&nbsp;<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>&nbsp;</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]>
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
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 Nov 3, 2026

This branch was successfully deployed

1 active and 4 inactive deployments
Preview – www — 7bbcd344 Deployed Nov 2, 2026 by vercel[bot]
Preview – examples-next-minimal-starter — 7bbcd344 Deployed Nov 2, 2026 by vercel[bot]
Preview – next-prisma-starter — 7bbcd344 Deployed Nov 2, 2026 by vercel[bot]
Preview – trpc-next-app-dir — 7bbcd344 Deployed Nov 2, 2026 by vercel[bot]
Preview – examples-todomvc — 7bbcd344 Deployed Nov 2, 2026 by vercel[bot]
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.

3 participants