Skip to content

docs(www): document dehydrate.shouldRedactErrors for Next.js builds - #8034

Merged
KATT merged 1 commit into
trpc:mainfrom
MindOfqc:fix/v11-dehydrate-should-redact-errors
Nov 10, 2026
Merged

KATT merged 1 commit into
trpc:mainfrom
MindOfqc:fix/v11-dehydrate-should-redact-errors

Conversation

@MindOfqc

@MindOfqc MindOfqc commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

I am adding the shouldRedactErrors note the issue asks for to both App Router pages, as docs only.

What this does

Adds dehydrate.shouldRedactErrors to the makeQueryClient() example in the App Router setup and Server Components pages, plus a bullet explaining it.

shouldDehydrateQuery dehydrates pending queries so their promise can be streamed. During a next build those queries can reject after dehydration, and the error is then redacted before Next.js reads the digest it uses to detect dynamic rendering — which fails the build. Returning false keeps the digest intact.

As the issue notes, Next.js redacts errors itself with better digests.

Notes

  • Docs only, no behaviour change — v11 keeps its defaults.
  • Matches the option shape used in TanStack Query's own next-15 integration example.

Regression check: n/a, docs only. I could not run pnpm --filter www check-twoslash here (no pnpm in this environment); the block is type-checked standalone against the shouldRedactErrors?: (error: unknown) => boolean signature.

Prepared with an AI coding agent.


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

Summary by CodeRabbit

  • Documentation
    • Updated the Next.js App Router and server components guides with examples that preserve error digests during query dehydration.
    • Added guidance explaining how error redaction can affect pending-query errors during builds and how Next.js handles dynamic-rendering errors.

Pending queries dehydrated during a Next.js build can reject later. Their
errors are then redacted before Next reads the digest it uses to detect
dynamic rendering, which fails the build. Document the shouldRedactErrors
option next to shouldDehydrateQuery in both App Router pages.
@MindOfqc
MindOfqc requested a review from a team as a code owner November 10, 2026 15:12
@vercel

vercel Bot commented Nov 10, 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 10, 2026 3:15pm UTC
6 Skipped Deployments
Project Deployment Actions Updated
examples-next-minimal-starter Skipped Skipped Nov 10, 2026 3:15pm UTC
examples-todomvc Skipped Skipped Nov 10, 2026 3:15pm UTC
next-prisma-starter Skipped Skipped Nov 10, 2026 3:15pm UTC
next-prisma-websockets-starter Skipped Skipped Nov 10, 2026 3:15pm UTC
tanstack-start-sse-chat Skipped Skipped Nov 10, 2026 3:15pm UTC
trpc-next-app-dir Skipped Skipped Nov 10, 2026 3:15pm UTC

Request Review

@vercel
vercel Bot temporarily deployed to Preview – examples-next-minimal-starter November 10, 2026 15:12 Inactive
@vercel
vercel Bot temporarily deployed to Preview – examples-todomvc November 10, 2026 15:12 Inactive
@vercel
vercel Bot temporarily deployed to Preview – next-prisma-starter November 10, 2026 15:12 Inactive
@vercel
vercel Bot temporarily deployed to Preview – trpc-next-app-dir November 10, 2026 15:12 Inactive
@coderabbitai

coderabbitai Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The Next.js guides add shouldRedactErrors to their QueryClient examples and explain how disabling error redaction preserves error digests during dehydration.

Changes: Next.js error digest documentation

Layer / File(s) Summary
Document dehydration error handling
www/v11/docs/client/nextjs/app-router-setup.md, www/v11/docs/client/tanstack-react-query/server-components.md
Both guides set shouldRedactErrors to return false. They explain that preserving pending-query error digests allows Next.js to recognize dynamic-rendering errors during builds.

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

Change: Other · Severity of issue fixed: Medium

Possibly related PRs

  • trpc/trpc#7957: Changes pending-query dehydration behavior and tests pending-query failures during hydration.
  • trpc/trpc#7847: Documents pending queries in the server-component query flow.

Suggested reviewers: katt

Merge Risk: Minimal · up to 6645d

This PR only updates documentation examples for Next.js dehydration error handling. It has no runtime impact on the library and carries no meaningful merge risk. The semantic PR title check should be fixed separately.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check Passed Issue #6771 requests Next.js documentation that sets dehydrate.shouldRedactErrors to return false and explains why. Both www/v11/docs/client/nextjs/app-router-setup.md and `www/v11/docs/client/t…
Out of Scope Changes check Passed The diff only changes the two App Router and Server Components documentation pages named by issue #6771. The examples and explanatory text directly support the issue objective. No unrelated changes ap…
Title check Passed The title clearly describes the documentation change: explaining dehydrate.shouldRedactErrors for Next.js builds.
Full details: Linked Issues check

Explanation

Issue #6771 requests Next.js documentation that sets dehydrate.shouldRedactErrors to return false and explains why. Both www/v11/docs/client/nextjs/app-router-setup.md and www/v11/docs/client/tanstack-react-query/server-components.md add this setting and explain how preserving the error digest supports Next.js dynamic-rendering detection.

Full details: Out of Scope Changes check

Explanation

The diff only changes the two App Router and Server Components documentation pages named by issue #6771. The examples and explanatory text directly support the issue objective. No unrelated changes appear in the diff.

Finishing Touches

Generate unit tests (beta)

  • 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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: trpc/trpc
  • Branch: main
  • File: .coderabbit.yaml
  • Commit: 5b993cf
  • Layers: Repository YAML
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c36ae789-d7a9-4632-9ea2-1443a6cedf71
Commits

Reviewing files that changed from the base of the PR and between 5b993cf and 6645d59.

Files selected for processing: 2

  • www/v11/docs/client/nextjs/app-router-setup.md
  • www/v11/docs/client/tanstack-react-query/server-components.md

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

@pkg-pr-new

pkg-pr-new Bot commented Nov 10, 2026

Copy link
Copy Markdown

Open in StackBlitz

@trpc/client

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

@trpc/next

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

@trpc/openapi

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

@trpc/react-query

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

@trpc/server

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

@trpc/tanstack-react-query

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

@trpc/upgrade

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

commit: 6645d59

@MindOfqc MindOfqc changed the title docs(v11): document dehydrate.shouldRedactErrors for Next.js builds docs(www): document dehydrate.shouldRedactErrors for Next.js builds Nov 10, 2026
@KATT
KATT added this pull request to the merge queue Nov 10, 2026
Merged via the queue into trpc:main with commit 57482b0 Nov 10, 2026
53 of 55 checks passed
@github-actions

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 11, 2026

This branch was successfully deployed

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

docs: Disable error redaction on dehydration when using Next.js

2 participants