@trpc/react-query 11.0.0-rc.436 → 11.0.0-rc.441

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.
@@ -1,7 +1,7 @@
1
1
  {
2
- "bundleSize": 32073,
3
- "bundleOrigSize": 68892,
4
- "bundleReduction": 53.44,
2
+ "bundleSize": 32354,
3
+ "bundleOrigSize": 69172,
4
+ "bundleReduction": 53.23,
5
5
  "modules": [
6
6
  {
7
7
  "id": "/src/shared/hooks/createHooksInternal.tsx",
@@ -14,7 +14,7 @@
14
14
  "dependents": [
15
15
  "/src/createTRPCReact.tsx"
16
16
  ],
17
- "percent": 42.93,
17
+ "percent": 42.56,
18
18
  "reduction": 12.76
19
19
  },
20
20
  {
@@ -29,7 +29,7 @@
29
29
  "/src/createTRPCQueryUtils.tsx",
30
30
  "/src/shared/hooks/createHooksInternal.tsx"
31
31
  ],
32
- "percent": 11.79,
32
+ "percent": 11.69,
33
33
  "reduction": 6.34
34
34
  },
35
35
  {
@@ -43,20 +43,20 @@
43
43
  "dependents": [
44
44
  "/src/server/index.ts"
45
45
  ],
46
- "percent": 10.87,
46
+ "percent": 10.77,
47
47
  "reduction": 52.58
48
48
  },
49
49
  {
50
50
  "id": "/src/rsc.tsx",
51
- "size": 2839,
52
- "origSize": 5014,
51
+ "size": 3120,
52
+ "origSize": 5294,
53
53
  "renderedExports": [
54
54
  "createHydrationHelpers"
55
55
  ],
56
56
  "removedExports": [],
57
57
  "dependents": [],
58
- "percent": 8.85,
59
- "reduction": 43.38
58
+ "percent": 9.64,
59
+ "reduction": 41.07
60
60
  },
61
61
  {
62
62
  "id": "/src/shared/proxy/utilsProxy.ts",
@@ -71,7 +71,7 @@
71
71
  "dependents": [
72
72
  "/src/shared/index.ts"
73
73
  ],
74
- "percent": 8.83,
74
+ "percent": 8.75,
75
75
  "reduction": 74.84
76
76
  },
77
77
  {
@@ -91,7 +91,7 @@
91
91
  "/src/shared/proxy/useQueriesProxy.ts",
92
92
  "/src/shared/hooks/createHooksInternal.tsx"
93
93
  ],
94
- "percent": 6.23,
94
+ "percent": 6.18,
95
95
  "reduction": 42.49
96
96
  },
97
97
  {
@@ -106,7 +106,7 @@
106
106
  "dependents": [
107
107
  "/src/index.ts"
108
108
  ],
109
- "percent": 2.73,
109
+ "percent": 2.7,
110
110
  "reduction": 89.53
111
111
  },
112
112
  {
@@ -120,7 +120,7 @@
120
120
  "dependents": [
121
121
  "/src/shared/index.ts"
122
122
  ],
123
- "percent": 2.44,
123
+ "percent": 2.42,
124
124
  "reduction": 24
125
125
  },
126
126
  {
@@ -135,7 +135,7 @@
135
135
  "/src/shared/index.ts",
136
136
  "/src/shared/hooks/createHooksInternal.tsx"
137
137
  ],
138
- "percent": 1.77,
138
+ "percent": 1.76,
139
139
  "reduction": 82.1
140
140
  },
141
141
  {
@@ -151,7 +151,7 @@
151
151
  "/src/shared/hooks/createHooksInternal.tsx",
152
152
  "/src/utils/createUtilityFunctions.ts"
153
153
  ],
154
- "percent": 1.47,
154
+ "percent": 1.46,
155
155
  "reduction": 17.31
156
156
  },
157
157
  {
@@ -179,7 +179,7 @@
179
179
  "dependents": [
180
180
  "/src/index.ts"
181
181
  ],
182
- "percent": 0.51,
182
+ "percent": 0.5,
183
183
  "reduction": 66.6
184
184
  },
185
185
  {
package/dist/rsc.d.ts CHANGED
@@ -15,7 +15,23 @@ type DecorateRouterRecord<TRoot extends AnyRootTypes, TRecord extends RouterReco
15
15
  };
16
16
  type Caller<TRouter extends AnyRouter> = ReturnType<RouterCaller<inferRouterRootTypes<TRouter>, TRouter['_def']['record']>>;
17
17
  /**
18
- * @note This requires `@tanstack/react-query@^5.45.0`
18
+ * @note This requires `@tanstack/react-query@^5.49.0`
19
+ * @note Make sure to have `dehyrate.serializeData` and `hydrate.deserializeData`
20
+ * set to your data transformer in your `QueryClient` factory.
21
+ * @example
22
+ * ```ts
23
+ * export const createQueryClient = () =>
24
+ * new QueryClient({
25
+ * defaultOptions: {
26
+ * dehydrate: {
27
+ * serializeData: transformer.serialize,
28
+ * },
29
+ * hydrate: {
30
+ * deserializeData: transformer.deserialize,
31
+ * },
32
+ * },
33
+ * });
34
+ * ```
19
35
  */
20
36
  export declare function createHydrationHelpers<TRouter extends AnyRouter>(caller: AnyRouter extends TRouter ? TypeError<'Generic parameter missing in `createHydrationHelpers<HERE>`'> : Caller<TRouter>, getQueryClient: () => QueryClient): {
21
37
  /***
package/dist/rsc.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"rsc.d.ts","sourceRoot":"","sources":["../src/rsc.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,WAAW,EACjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAEL,KAAK,SAAS,EACd,KAAK,mBAAmB,EACxB,KAAK,YAAY,EAClB,MAAM,0CAA0C,CAAC;AAClD,OAAO,KAAK,EACV,YAAY,EACZ,YAAY,EACZ,oBAAoB,EACpB,oBAAoB,EAEpB,YAAY,EACZ,SAAS,EACV,MAAM,0CAA0C,CAAC;AAClD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EACV,6BAA6B,EAC7B,qBAAqB,EACtB,MAAM,UAAU,CAAC;AAIlB,KAAK,iBAAiB,CACpB,KAAK,SAAS,YAAY,EAC1B,UAAU,SAAS,YAAY,IAC7B;IACF,CAAC,KAAK,EAAE,mBAAmB,CAAC,UAAU,CAAC,GAAG,OAAO,CAC/C,oBAAoB,CAAC,UAAU,CAAC,CACjC,CAAC;IACF,QAAQ,EAAE,CACR,KAAK,EAAE,mBAAmB,CAAC,UAAU,CAAC,EACtC,IAAI,CAAC,EAAE,qBAAqB,CAC1B,+BAA+B,CAAC,KAAK,EAAE,UAAU,CAAC,EAClD,eAAe,CAAC,KAAK,CAAC,C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G,OAAO,CAAC,IAAI,CAAC,SAAS,YAAY,GACvD,iBAAiB,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,GACvC,OAAO,CAAC,IAAI,CAAC,SAAS,YAAY,GAClC,oBAAoB,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,GAC1C,KAAK;CACV,CAAC;AAEF,KAAK,MAAM,CAAC,OAAO,SAAS,SAAS,IAAI,UAAU,CACjD,YAAY,CAAC,oBAAoB,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,CACvE,CAAC;AAGF;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,SAAS,SAAS,EAC9D,MAAM,EAAE,SAAS,SAAS,OAAO,GAC7B,SAAS,CAAC,6DAA6D,CAAC,GACxE,MAAM,CAAC,OAAO,CAAC,EACnB,cAAc,EAAE,MAAM,WAAW;IAwD/B;;;;;;;;;;;OAWG;;IAEH;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;2BAhDyB;QAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;KAAE;EAmD5D"}
package/dist/rsc.js CHANGED
@@ -24,31 +24,43 @@ function _interopNamespaceDefault(e) {
24
24
 
25
25
  var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
26
26
 
27
+ /// <reference types="react/canary" />
27
28
  const HELPERS = [
28
29
  'prefetch',
29
30
  'prefetchInfinite'
30
31
  ];
31
32
  // ts-prune-ignore-next
32
33
  /**
33
- * @note This requires `@tanstack/react-query@^5.45.0`
34
+ * @note This requires `@tanstack/react-query@^5.49.0`
35
+ * @note Make sure to have `dehyrate.serializeData` and `hydrate.deserializeData`
36
+ * set to your data transformer in your `QueryClient` factory.
37
+ * @example
38
+ * ```ts
39
+ * export const createQueryClient = () =>
40
+ * new QueryClient({
41
+ * defaultOptions: {
42
+ * dehydrate: {
43
+ * serializeData: transformer.serialize,
44
+ * },
45
+ * hydrate: {
46
+ * deserializeData: transformer.deserialize,
47
+ * },
48
+ * },
49
+ * });
50
+ * ```
34
51
  */ function createHydrationHelpers(caller, getQueryClient) {
35
- const wrappedProxy = unstableCoreDoNotImport.createRecursiveProxy(async ({ path , args })=>{
52
+ const wrappedProxy = unstableCoreDoNotImport.createRecursiveProxy(({ path , args })=>{
36
53
  const proc = path.reduce((acc, key)=>// @ts-expect-error - ??
37
54
  HELPERS.includes(key) ? acc : acc[key], caller);
38
55
  const input = args[0];
39
56
  const promise = proc(input);
40
- const queryFn = async ()=>{
41
- const def = await caller._def();
42
- const transformer = def._config.transformer;
43
- return promise.then((value)=>transformer.output.serialize(value));
44
- };
45
57
  const helper = path.pop();
46
58
  if (helper === 'prefetch') {
47
59
  const args1 = args[1];
48
60
  return getQueryClient().prefetchQuery({
49
61
  ...args1,
50
62
  queryKey: getQueryKey.getQueryKeyInternal(path, input, 'query'),
51
- queryFn
63
+ queryFn: ()=>promise
52
64
  });
53
65
  }
54
66
  if (helper === 'prefetchInfinite') {
@@ -56,7 +68,7 @@ const HELPERS = [
56
68
  return getQueryClient().prefetchInfiniteQuery({
57
69
  ...args11,
58
70
  queryKey: getQueryKey.getQueryKeyInternal(path, input, 'infinite'),
59
- queryFn,
71
+ queryFn: ()=>promise,
60
72
  initialPageParam: args11?.initialCursor ?? null
61
73
  });
62
74
  }
package/dist/rsc.mjs CHANGED
@@ -3,31 +3,43 @@ import { createRecursiveProxy } from '@trpc/server/unstable-core-do-not-import';
3
3
  import * as React from 'react';
4
4
  import { getQueryKeyInternal } from './internals/getQueryKey.mjs';
5
5
 
6
+ /// <reference types="react/canary" />
6
7
  const HELPERS = [
7
8
  'prefetch',
8
9
  'prefetchInfinite'
9
10
  ];
10
11
  // ts-prune-ignore-next
11
12
  /**
12
- * @note This requires `@tanstack/react-query@^5.45.0`
13
+ * @note This requires `@tanstack/react-query@^5.49.0`
14
+ * @note Make sure to have `dehyrate.serializeData` and `hydrate.deserializeData`
15
+ * set to your data transformer in your `QueryClient` factory.
16
+ * @example
17
+ * ```ts
18
+ * export const createQueryClient = () =>
19
+ * new QueryClient({
20
+ * defaultOptions: {
21
+ * dehydrate: {
22
+ * serializeData: transformer.serialize,
23
+ * },
24
+ * hydrate: {
25
+ * deserializeData: transformer.deserialize,
26
+ * },
27
+ * },
28
+ * });
29
+ * ```
13
30
  */ function createHydrationHelpers(caller, getQueryClient) {
14
- const wrappedProxy = createRecursiveProxy(async ({ path , args })=>{
31
+ const wrappedProxy = createRecursiveProxy(({ path , args })=>{
15
32
  const proc = path.reduce((acc, key)=>// @ts-expect-error - ??
16
33
  HELPERS.includes(key) ? acc : acc[key], caller);
17
34
  const input = args[0];
18
35
  const promise = proc(input);
19
- const queryFn = async ()=>{
20
- const def = await caller._def();
21
- const transformer = def._config.transformer;
22
- return promise.then((value)=>transformer.output.serialize(value));
23
- };
24
36
  const helper = path.pop();
25
37
  if (helper === 'prefetch') {
26
38
  const args1 = args[1];
27
39
  return getQueryClient().prefetchQuery({
28
40
  ...args1,
29
41
  queryKey: getQueryKeyInternal(path, input, 'query'),
30
- queryFn
42
+ queryFn: ()=>promise
31
43
  });
32
44
  }
33
45
  if (helper === 'prefetchInfinite') {
@@ -35,7 +47,7 @@ const HELPERS = [
35
47
  return getQueryClient().prefetchInfiniteQuery({
36
48
  ...args11,
37
49
  queryKey: getQueryKeyInternal(path, input, 'infinite'),
38
- queryFn,
50
+ queryFn: ()=>promise,
39
51
  initialPageParam: args11?.initialCursor ?? null
40
52
  });
41
53
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trpc/react-query",
3
- "version": "11.0.0-rc.436+fbb4a2fb4",
3
+ "version": "11.0.0-rc.441+0c4a58144",
4
4
  "description": "The tRPC React library",
5
5
  "author": "KATT",
6
6
  "license": "MIT",
@@ -63,16 +63,16 @@
63
63
  }
64
64
  },
65
65
  "peerDependencies": {
66
- "@tanstack/react-query": "^5.40.0",
67
- "@trpc/client": "11.0.0-rc.436+fbb4a2fb4",
68
- "@trpc/server": "11.0.0-rc.436+fbb4a2fb4",
66
+ "@tanstack/react-query": "^5.49.2",
67
+ "@trpc/client": "11.0.0-rc.441+0c4a58144",
68
+ "@trpc/server": "11.0.0-rc.441+0c4a58144",
69
69
  "react": ">=18.2.0",
70
70
  "react-dom": ">=18.2.0"
71
71
  },
72
72
  "devDependencies": {
73
- "@tanstack/react-query": "^5.45.0",
74
- "@trpc/client": "11.0.0-rc.436+fbb4a2fb4",
75
- "@trpc/server": "11.0.0-rc.436+fbb4a2fb4",
73
+ "@tanstack/react-query": "^5.49.2",
74
+ "@trpc/client": "11.0.0-rc.441+0c4a58144",
75
+ "@trpc/server": "11.0.0-rc.441+0c4a58144",
76
76
  "@types/express": "^4.17.17",
77
77
  "@types/node": "^20.10.0",
78
78
  "@types/react": "^18.3.1",
@@ -92,5 +92,5 @@
92
92
  "funding": [
93
93
  "https://trpc.io/sponsor"
94
94
  ],
95
- "gitHead": "fbb4a2fb4b71d2f5ab7ee97617d951f3a92517c8"
95
+ "gitHead": "0c4a581449b6cbf187e597dbd7ea29381878f2e8"
96
96
  }
package/src/rsc.tsx CHANGED
@@ -1,3 +1,5 @@
1
+ /// <reference types="react/canary" />
2
+
1
3
  import {
2
4
  dehydrate,
3
5
  HydrationBoundary,
@@ -70,7 +72,23 @@ type Caller<TRouter extends AnyRouter> = ReturnType<
70
72
 
71
73
  // ts-prune-ignore-next
72
74
  /**
73
- * @note This requires `@tanstack/react-query@^5.45.0`
75
+ * @note This requires `@tanstack/react-query@^5.49.0`
76
+ * @note Make sure to have `dehyrate.serializeData` and `hydrate.deserializeData`
77
+ * set to your data transformer in your `QueryClient` factory.
78
+ * @example
79
+ * ```ts
80
+ * export const createQueryClient = () =>
81
+ * new QueryClient({
82
+ * defaultOptions: {
83
+ * dehydrate: {
84
+ * serializeData: transformer.serialize,
85
+ * },
86
+ * hydrate: {
87
+ * deserializeData: transformer.deserialize,
88
+ * },
89
+ * },
90
+ * });
91
+ * ```
74
92
  */
75
93
  export function createHydrationHelpers<TRouter extends AnyRouter>(
76
94
  caller: AnyRouter extends TRouter
@@ -79,9 +97,10 @@ export function createHydrationHelpers<TRouter extends AnyRouter>(
79
97
  getQueryClient: () => QueryClient,
80
98
  ) {
81
99
  type RootTypes = inferRouterRootTypes<TRouter>;
100
+
82
101
  const wrappedProxy = createRecursiveProxy<
83
102
  DecorateRouterRecord<RootTypes, TRouter['_def']['record']>
84
- >(async ({ path, args }) => {
103
+ >(({ path, args }) => {
85
104
  const proc = path.reduce(
86
105
  (acc, key) =>
87
106
  // @ts-expect-error - ??
@@ -92,12 +111,6 @@ export function createHydrationHelpers<TRouter extends AnyRouter>(
92
111
  const input = args[0];
93
112
  const promise = proc(input);
94
113
 
95
- const queryFn = async () => {
96
- const def: AnyRouter['_def'] = await (caller as any)._def();
97
- const transformer = def._config.transformer;
98
- return promise.then((value) => transformer.output.serialize(value));
99
- };
100
-
101
114
  const helper = path.pop();
102
115
  if (helper === 'prefetch') {
103
116
  const args1 = args[1] as Maybe<
@@ -107,7 +120,7 @@ export function createHydrationHelpers<TRouter extends AnyRouter>(
107
120
  return getQueryClient().prefetchQuery({
108
121
  ...args1,
109
122
  queryKey: getQueryKeyInternal(path, input, 'query'),
110
- queryFn,
123
+ queryFn: () => promise,
111
124
  });
112
125
  }
113
126
  if (helper === 'prefetchInfinite') {
@@ -118,7 +131,7 @@ export function createHydrationHelpers<TRouter extends AnyRouter>(
118
131
  return getQueryClient().prefetchInfiniteQuery({
119
132
  ...args1,
120
133
  queryKey: getQueryKeyInternal(path, input, 'infinite'),
121
- queryFn,
134
+ queryFn: () => promise,
122
135
  initialPageParam: args1?.initialCursor ?? null,
123
136
  });
124
137
  }