Skip to content

docs: update tRPC migration guide to tRPC v11 APIs - #2311

Merged
dinwwwh merged 1 commit into
mainfrom
claude/project-thread-bctx90
Oct 23, 2026
Merged

dinwwwh merged 1 commit into
mainfrom
claude/project-thread-bctx90

Conversation

@dinwwwh

@dinwwwh dinwwwh commented Oct 23, 2026

Copy link
Copy Markdown
Member

Requested by dinwwwh · project thread

Summary

The "Migrating from tRPC" guide tells readers to uninstall the v11 packages (@trpc/tanstack-react-query only exists for v11), but some tRPC snippets still used v10 APIs or options tRPC doesn't support. This PR fixes only the tRPC side of apps/content/docs/migrations/from-trpc.mdx:

  • Client setup: createTRPCProxyClient → createTRPCClient (the old name is a deprecated alias in v11).
  • Client setup: pass transformer: superjson to httpLink. In v11 the transformer lives on the link, and since the server example uses superjson, leaving it out is a type error.
  • Error handling: remove data from the TRPCError example, since the constructor only takes code, message, and cause. The intro sentence now says that ORPCError accepts data directly.
  • Concept table: context is initTRPC.context<T>(), not t.context(). The oRPC column now shows os.$context<T>() so the two match.

Verification

  • Type-checked the updated tRPC snippets (base, router, vanilla client, TanStack Query usage, error) against @trpc/server, @trpc/client, and @trpc/tanstack-react-query 11.19.0 with strict. They compile with no errors. The previous client snippet (no transformer) and the data option both fail.
  • pnpm docs:validate passes (0 JSDoc errors, blume validate --strict finds no broken links).

Generated by Claude Code

- Use createTRPCClient instead of the deprecated createTRPCProxyClient
- Pass the superjson transformer to httpLink, as v11 requires it on links
- Drop the unsupported data option from the TRPCError example
- List initTRPC.context<T>() for context in the concept table

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018GtLLKwPMbDUwRXzt74JyZ
@dinwwwh dinwwwh self-assigned this Oct 23, 2026
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
orpc eeda240 Commit Preview URL

Branch Preview URL
Oct 23 2026, 02:49 AM

@macroscopeapp

macroscopeapp Bot commented Oct 23, 2026

Copy link
Copy Markdown

Approvability

Verdict: Approved at eeda240

Macroscope's review found this PR approvable — This PR only updates a single migration-guide MDX file with tRPC v11 syntax and corrected examples. It does not modify runtime code or production configuration, so its repository blast radius is limited to documentation.

You can add or adjust custom eligibility rules. Learn more.

@codecov

codecov Bot commented Oct 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@codspeed

codspeed Bot commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

1 warning

⚠️ 5 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

✅ 28 untouched benchmarks
⏩ 2 skipped benchmarks1


Comparing claude/project-thread-bctx90 (eeda240) with main (07c2593)

Open in CodSpeed

Footnotes

  1. 2 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@pkg-pr-new

pkg-pr-new Bot commented Oct 23, 2026

Copy link
Copy Markdown
More templates

@orpc/ai-sdk

npm i https://pkg.pr.new/@orpc/ai-sdk@2311

@orpc/arktype

npm i https://pkg.pr.new/@orpc/arktype@2311

@orpc/bun

npm i https://pkg.pr.new/@orpc/bun@2311

@orpc/client

npm i https://pkg.pr.new/@orpc/client@2311

@orpc/cloudflare

npm i https://pkg.pr.new/@orpc/cloudflare@2311

@orpc/contract

npm i https://pkg.pr.new/@orpc/contract@2311

@orpc/experimental-effect

npm i https://pkg.pr.new/@orpc/experimental-effect@2311

@orpc/evlog

npm i https://pkg.pr.new/@orpc/evlog@2311

@orpc/hibernation

npm i https://pkg.pr.new/@orpc/hibernation@2311

@orpc/json-schema

npm i https://pkg.pr.new/@orpc/json-schema@2311

@orpc/experimental-lock

npm i https://pkg.pr.new/@orpc/experimental-lock@2311

@orpc/mcp

npm i https://pkg.pr.new/@orpc/mcp@2311

@orpc/msw

npm i https://pkg.pr.new/@orpc/msw@2311

@orpc/nest

npm i https://pkg.pr.new/@orpc/nest@2311

@orpc/next

npm i https://pkg.pr.new/@orpc/next@2311

@orpc/node

npm i https://pkg.pr.new/@orpc/node@2311

@orpc/openapi

npm i https://pkg.pr.new/@orpc/openapi@2311

@orpc/opentelemetry

npm i https://pkg.pr.new/@orpc/opentelemetry@2311

@orpc/pinia-colada

npm i https://pkg.pr.new/@orpc/pinia-colada@2311

@orpc/pino

npm i https://pkg.pr.new/@orpc/pino@2311

@orpc/publisher

npm i https://pkg.pr.new/@orpc/publisher@2311

@orpc/ratelimit

npm i https://pkg.pr.new/@orpc/ratelimit@2311

@orpc/server

npm i https://pkg.pr.new/@orpc/server@2311

@orpc/shared

npm i https://pkg.pr.new/@orpc/shared@2311

@orpc/swr

npm i https://pkg.pr.new/@orpc/swr@2311

@orpc/tanstack-query

npm i https://pkg.pr.new/@orpc/tanstack-query@2311

@orpc/trpc

npm i https://pkg.pr.new/@orpc/trpc@2311

@orpc/valibot

npm i https://pkg.pr.new/@orpc/valibot@2311

@orpc/zod

npm i https://pkg.pr.new/@orpc/zod@2311

commit: eeda240

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes — docs-only correction to the tRPC column of apps/content/docs/migrations/from-trpc.mdx (tRPC v11 API fixes):

  • Concept table — Context row: t.context() → initTRPC.context<T>(), and the oRPC side to os.$context<T>(). Correct: initTRPC.context<T>().create() is the v11 form.
  • Error Handling: dropped data: 'some data' from the TRPCError example and reworded the intro to note ORPCError takes the code first and accepts data directly. Upstream TRPCError's constructor is { message?, code, cause? } — no data — so this is right.
  • Client setup: createTRPCProxyClient → createTRPCClient, plus import superjson and transformer: superjson on httpLink. Matches the v11 docs' canonical transformer example, and the client link must match the server's initTRPC...create({ transformer: superjson }).

I verified every tRPC claim against the trpc.io v11 docs and the upstream TRPCError/initTRPC sources, and the oRPC claims against this repo (os.$context<T>() at packages/server/src/builder.ts:78; ORPCError's data option at packages/client/src/error.ts:43). One thing worth noting for future edits: the untouched base example's initTRPC.context<typeof createTRPCContext>() is valid v11 — context<T>() unwraps a callback type — so it is not an oversight.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@dinwwwh
dinwwwh merged commit 4c6b6b3 into main Oct 23, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants