Skip to main content
Version: 11.x

Migrate from v10 to v11

info

This is a current work in progress representing version 11.

  • The functionality is stable and can be used in production, but we may do small breaking API-changes between patches until we reach 11.0.0
  • The packages are published with the next-tag on npm

Installation / upgrading

npm install @trpc/server@next @trpc/client@next @trpc/react-query@next @trpc/next@next @tanstack/react-query@latest @tanstack/react-query-devtools@latest

Reverse-chronological changelog

This is a draft document. It will be updated to a proper guide as we get closer to the v11 release. The only major thing that will incur work for you is that you will need to do is to update TanStack Query to v5.0.0.

Added a @trpc/core-package

We moved a bunch of internals of @trpc/server to a new package called @trpc/core that is not meant for public consumption

Please create an issue on GitHub or start a conversation in #v11-chats channel on Discord if:

  • You are missing types from @trpc/server after upgrading (also for plugin authors)
  • Get an error akin to "The inferred type of 'createContext' cannot be named without a reference to [...]"

Added useSuspenseQueries()

See useSuspenseQueries

https://github.com/trpc/trpc/pull/5226

Refactor internal generics

We have refactored our internal generics and made them more readable (TODO: link procedure builder sauce)

React is now >=18.2.0

Check their migration guide: https://react.dev/blog/2022/03/08/react-18-upgrade-guide

  • Ability to pass a Promise in the url-callback if servers switch location during deploys
  • Added new lazy option that makes the websocket automatically disconnect when there are no pending requests

rawInput in middleware is now a getRawInput

While we're not doing anything differently internally (just yet) this is help support a much requested feature in tRPC: content types other than JSON.

Simplified types and .d.ts outputs

Procedures in your router now only emit their input & output - where before they would also contain the full context object for every procedure, leading to unnecessary complexity in e.g. .d.ts.

React Query peerDep is now v5

Check their migration guide: https://tanstack.com/query/v5/docs/react/guides/migrating-to-v5

Exports names AbcProxyXyz has been renamed to AbcXyz

The proxy names were due to v9 using the AbcXyz names, these have been removed and the proxy ones have been renamed to the non-proxy names, e.g:

  • createTRPCClient was deprecated from v9, and is now completely removed. The createTRPCProxyClient has been renamed to createTRPCClient instead. createTRPCProxyClient is now marked as deprecated.

SSG Helpers

  • createSSGHelpers were for v9 which has now been removed. the v10 equivalent createProxySSGHelpers have been renamed to createSSGHelpers now instead.
  • createProxySSGHelpers is now deprecated but aliased to createSSGHelpers for backwards compatibility.
  • Removed exported type CreateSSGHelpersOptions

.unstable_concat() removed

To our knowledge, this was never used by anyone. If you need it, please open an issue on GitHub.

We might add it back in the future if there is a need for it.

interop-mode has been removed

We have removed the interop-mode from tRPC. This was a mode that allowed you to have an easy transition period from v9 to v10. This mode was never meant to be supported long-term and we have now removed it.