@trpc/tanstack-react-query 11.28.6 → 11.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@trpc/tanstack-react-query",
3
3
  "type": "module",
4
- "version": "11.28.6",
4
+ "version": "11.29.0",
5
5
  "description": "TanStack React Query Integration for tRPC",
6
6
  "author": "juliusmarminge",
7
7
  "license": "MIT",
@@ -59,16 +59,16 @@
59
59
  ],
60
60
  "peerDependencies": {
61
61
  "@tanstack/react-query": "^5.106.0",
62
- "@trpc/client": "11.28.6",
63
- "@trpc/server": "11.28.6",
62
+ "@trpc/client": "11.29.0",
63
+ "@trpc/server": "11.29.0",
64
64
  "react": ">=18.2.0",
65
65
  "typescript": ">=5.7.2"
66
66
  },
67
67
  "devDependencies": {
68
68
  "@tanstack/intent": "0.5.6",
69
69
  "@tanstack/react-query": "^5.107.1",
70
- "@trpc/client": "11.28.6",
71
- "@trpc/server": "11.28.6",
70
+ "@trpc/client": "11.29.0",
71
+ "@trpc/server": "11.29.0",
72
72
  "@types/node": "^24.19.2",
73
73
  "@types/react": "^19.3.0",
74
74
  "event-source-polyfill": "^1.0.31",
@@ -8,7 +8,7 @@ sources:
8
8
  metadata:
9
9
  type: lifecycle
10
10
  library: trpc
11
- library_version: 11.28.6
11
+ library_version: 11.29.0
12
12
  ---
13
13
 
14
14
  <!-- Generated from www/v11/docs/client/tanstack-react-query/migrating.md by www/build/skills.ts. Edit the docs instead. -->
@@ -23,21 +23,20 @@ There are a few approaches to migrate over, and this library is a significant de
23
23
 
24
24
  ## Codemod migration
25
25
 
26
- > [!NOTE] Info
27
- > The codemod is a work in progress and we're looking for help to make it better. If you're interested in contributing to the codemod, please see [Julius' comment here](https://github.com/trpc/trpc/pull/6262#issuecomment-2651959435).
28
-
29
-
30
- We're working on a codemod to help you migrate your existing codebase over to the new client. This is already available to try but we need your feedback and contributions to improve it. Codemods are very tricky to get right so we're looking for your help to make it as effective as possible.
31
-
32
- Run our upgrade CLI:
26
+ Run the upgrade CLI from the folder with your `tsconfig.json`, on a git working tree without uncommitted changes:
33
27
 
34
28
  ```sh
35
- npx @trpc/upgrade
29
+ npx @trpc/upgrade --yes
36
30
  ```
37
31
 
38
- When prompted, select the transforms `Migrate Hooks to xxxOptions API` and `Migrate context provider setup`.
32
+ It runs two transforms over the files git tracks:
33
+
34
+ - **Setup:** `createTRPCReact` becomes `createTRPCContext`, `trpc.Provider` becomes `TRPCProvider`, and `trpc.createClient()` becomes `createTRPCClient()`. A `createTRPCNext` setup becomes the same file exporting `makeTRPCClient()`, `makeQueryClient()` and a `withTRPC()` for `_app`, which hydrates `trpcState` like before. See [Moving from `createTRPCNext`](https://trpc.io/docs/client/nextjs/pages-router/setup#moving-from-createtrpcnext).
35
+ - **Hooks:** each hook becomes the TanStack Query hook with an options factory, such as `useQuery(trpc.a.queryOptions(input))`, and `trpc.useUtils()` becomes `useQueryClient()` with the matching filters and keys. `trpc.useQueries()`, `useSuspenseQueries()`, `utils.client` and `getQueryKey()` are covered too, as in the [table below](https://trpc.io/docs/client/tanstack-react-query/migrating#equivalents-for-the-other-hooks-and-useutils). Each component or hook that needs it gets `const trpc = useTRPC()`.
36
+
37
+ Then it installs `@trpc/tanstack-react-query`, and uninstalls `@trpc/react-query` and `@trpc/next` unless a file still imports them, e.g. `createServerSideHelpers` from `@trpc/react-query/server`. Pass `--skipTanstackQuery` to leave your packages alone, or `--transforms provider` or `--transforms hooks` to run one transform. Without `--yes` or `--transforms`, it asks which to run.
39
38
 
40
- The CLI refuses to run on a git working tree with uncommitted changes, unless you pass `--force`. After the transforms it installs `@trpc/tanstack-react-query` and **uninstalls `@trpc/react-query`**, so pass `--skipTanstackQuery` if you want to keep both while you migrate gradually. It doesn't cover every pattern (`useQueries`, for example), so typecheck afterwards and migrate whatever is left by hand, using the mappings below.
39
+ What it can't move safely, such as `ssr: true` or a `trpc` used outside a component, gets a `TODO(@trpc/upgrade)` comment. Afterwards, format the changed files, typecheck, and search for those comments:
41
40
 
42
41
  ```sh
43
42
  npx tsc --noEmit
@@ -11,7 +11,7 @@ sources:
11
11
  metadata:
12
12
  type: framework
13
13
  library: trpc
14
- library_version: 11.28.6
14
+ library_version: 11.29.0
15
15
  ---
16
16
 
17
17
  <!-- Generated from www/v11/docs/client/tanstack-react-query/setup.md by www/build/skills.ts. Edit the docs instead. -->