@trpc/react-query 11.0.0-next.92 → 11.0.0-rc.330

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.
Files changed (109) hide show
  1. package/README.md +4 -4
  2. package/dist/bundle-analysis.json +83 -51
  3. package/dist/createTRPCQueryUtils.d.ts +4 -0
  4. package/dist/createTRPCQueryUtils.d.ts.map +1 -0
  5. package/dist/createTRPCQueryUtils.js +16 -0
  6. package/dist/createTRPCQueryUtils.mjs +14 -0
  7. package/dist/createTRPCReact.d.ts +55 -40
  8. package/dist/createTRPCReact.d.ts.map +1 -1
  9. package/dist/createTRPCReact.js +58 -0
  10. package/dist/createTRPCReact.mjs +36 -0
  11. package/dist/index.d.ts +2 -1
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +8 -36
  14. package/dist/index.mjs +3 -35
  15. package/dist/internals/context.d.ts +23 -18
  16. package/dist/internals/context.d.ts.map +1 -1
  17. package/dist/internals/context.js +33 -0
  18. package/dist/internals/context.mjs +11 -0
  19. package/dist/internals/getClientArgs.d.ts +8 -2
  20. package/dist/internals/getClientArgs.d.ts.map +1 -1
  21. package/dist/internals/getClientArgs.js +24 -0
  22. package/dist/internals/getClientArgs.mjs +22 -0
  23. package/dist/internals/getQueryKey.d.ts +8 -13
  24. package/dist/internals/getQueryKey.d.ts.map +1 -1
  25. package/dist/internals/getQueryKey.js +60 -0
  26. package/dist/internals/getQueryKey.mjs +57 -0
  27. package/dist/internals/useHookResult.d.ts +4 -6
  28. package/dist/internals/useHookResult.d.ts.map +1 -1
  29. package/dist/internals/useHookResult.js +35 -0
  30. package/dist/internals/useHookResult.mjs +14 -0
  31. package/dist/internals/useQueries.d.ts +32 -4
  32. package/dist/internals/useQueries.d.ts.map +1 -1
  33. package/dist/server/index.js +2 -103
  34. package/dist/server/index.mjs +1 -104
  35. package/dist/server/ssgProxy.d.ts +21 -21
  36. package/dist/server/ssgProxy.d.ts.map +1 -1
  37. package/dist/server/ssgProxy.js +109 -0
  38. package/dist/server/ssgProxy.mjs +107 -0
  39. package/dist/shared/hooks/createHooksInternal.d.ts +8 -31
  40. package/dist/shared/hooks/createHooksInternal.d.ts.map +1 -1
  41. package/dist/{createHooksInternal-e2034194.js → shared/hooks/createHooksInternal.js} +98 -226
  42. package/dist/{createHooksInternal-3d8ebfcf.mjs → shared/hooks/createHooksInternal.mjs} +70 -210
  43. package/dist/shared/hooks/types.d.ts +11 -7
  44. package/dist/shared/hooks/types.d.ts.map +1 -1
  45. package/dist/shared/index.d.ts +2 -2
  46. package/dist/shared/index.d.ts.map +1 -1
  47. package/dist/shared/index.js +14 -15
  48. package/dist/shared/index.mjs +7 -7
  49. package/dist/shared/polymorphism/mutationLike.d.ts +6 -7
  50. package/dist/shared/polymorphism/mutationLike.d.ts.map +1 -1
  51. package/dist/shared/polymorphism/queryLike.d.ts +10 -7
  52. package/dist/shared/polymorphism/queryLike.d.ts.map +1 -1
  53. package/dist/shared/polymorphism/routerLike.d.ts +6 -6
  54. package/dist/shared/polymorphism/routerLike.d.ts.map +1 -1
  55. package/dist/shared/polymorphism/utilsLike.d.ts +3 -3
  56. package/dist/shared/polymorphism/utilsLike.d.ts.map +1 -1
  57. package/dist/shared/proxy/decorationProxy.d.ts +2 -2
  58. package/dist/shared/proxy/decorationProxy.d.ts.map +1 -1
  59. package/dist/shared/proxy/decorationProxy.js +31 -0
  60. package/dist/shared/proxy/decorationProxy.mjs +29 -0
  61. package/dist/shared/proxy/useQueriesProxy.d.ts +14 -8
  62. package/dist/shared/proxy/useQueriesProxy.d.ts.map +1 -1
  63. package/dist/shared/proxy/useQueriesProxy.js +25 -0
  64. package/dist/shared/proxy/useQueriesProxy.mjs +23 -0
  65. package/dist/shared/proxy/utilsProxy.d.ts +28 -24
  66. package/dist/shared/proxy/utilsProxy.d.ts.map +1 -1
  67. package/dist/shared/proxy/utilsProxy.js +89 -0
  68. package/dist/shared/proxy/utilsProxy.mjs +85 -0
  69. package/dist/shared/queryClient.d.ts +2 -1
  70. package/dist/shared/queryClient.d.ts.map +1 -1
  71. package/dist/{queryClient-4d766c0c.mjs → shared/queryClient.mjs} +1 -1
  72. package/dist/shared/types.d.ts +2 -2
  73. package/dist/shared/types.d.ts.map +1 -1
  74. package/dist/utils/createUtilityFunctions.d.ts +23 -0
  75. package/dist/utils/createUtilityFunctions.d.ts.map +1 -0
  76. package/dist/utils/createUtilityFunctions.js +100 -0
  77. package/dist/utils/createUtilityFunctions.mjs +98 -0
  78. package/dist/utils/inferReactQueryProcedure.d.ts +11 -10
  79. package/dist/utils/inferReactQueryProcedure.d.ts.map +1 -1
  80. package/package.json +18 -18
  81. package/src/createTRPCQueryUtils.tsx +11 -0
  82. package/src/createTRPCReact.tsx +139 -163
  83. package/src/index.ts +6 -1
  84. package/src/internals/context.tsx +27 -18
  85. package/src/internals/getClientArgs.ts +16 -4
  86. package/src/internals/getQueryKey.ts +51 -62
  87. package/src/internals/useHookResult.ts +12 -13
  88. package/src/internals/useQueries.ts +129 -4
  89. package/src/server/ssgProxy.ts +59 -57
  90. package/src/shared/hooks/createHooksInternal.tsx +115 -246
  91. package/src/shared/hooks/types.ts +15 -7
  92. package/src/shared/index.ts +5 -2
  93. package/src/shared/polymorphism/mutationLike.ts +21 -15
  94. package/src/shared/polymorphism/queryLike.ts +34 -14
  95. package/src/shared/polymorphism/routerLike.ts +29 -15
  96. package/src/shared/polymorphism/utilsLike.ts +6 -3
  97. package/src/shared/proxy/decorationProxy.ts +3 -3
  98. package/src/shared/proxy/useQueriesProxy.ts +65 -28
  99. package/src/shared/proxy/utilsProxy.ts +113 -86
  100. package/src/shared/queryClient.ts +2 -1
  101. package/src/shared/types.ts +5 -2
  102. package/src/utils/createUtilityFunctions.ts +137 -0
  103. package/src/utils/inferReactQueryProcedure.ts +38 -28
  104. package/dist/createHooksInternal-dce6e141.js +0 -435
  105. package/dist/queryClient-1c8d7d8a.js +0 -8
  106. package/dist/utilsProxy-00894da2.mjs +0 -121
  107. package/dist/utilsProxy-27bd93c1.js +0 -128
  108. package/dist/utilsProxy-7e396600.js +0 -114
  109. /package/dist/{queryClient-358a9a75.js → shared/queryClient.js} +0 -0
@@ -1,214 +1,78 @@
1
1
  'use strict';
2
2
 
3
- var shared = require('@trpc/server/shared');
4
3
  var reactQuery = require('@tanstack/react-query');
5
4
  var client = require('@trpc/client');
6
5
  var React = require('react');
7
- var utilsProxy = require('./utilsProxy-27bd93c1.js');
6
+ var context = require('../../internals/context.js');
7
+ var getClientArgs = require('../../internals/getClientArgs.js');
8
+ var getQueryKey = require('../../internals/getQueryKey.js');
9
+ var useHookResult = require('../../internals/useHookResult.js');
10
+ var createUtilityFunctions = require('../../utils/createUtilityFunctions.js');
11
+ var useQueriesProxy = require('../proxy/useQueriesProxy.js');
8
12
 
9
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
10
-
11
- var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
12
-
13
- /**
14
- * Create proxy for decorating procedures
15
- * @internal
16
- */ function createReactDecoration(name, hooks) {
17
- return shared.createRecursiveProxy(({ path , args })=>{
18
- const pathCopy = [
19
- name,
20
- ...path
21
- ];
22
- // The last arg is for instance `.useMutation` or `.useQuery()`
23
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
24
- const lastArg = pathCopy.pop();
25
- if (lastArg === 'useMutation') {
26
- return hooks[lastArg](pathCopy, ...args);
27
- }
28
- if (lastArg === '_def') {
29
- return {
30
- path: pathCopy
31
- };
32
- }
33
- const [input, ...rest] = args;
34
- const opts = rest[0] || {};
35
- return hooks[lastArg](pathCopy, input, opts);
36
- });
37
- }
38
-
39
- /**
40
- * Create proxy for `useQueries` options
41
- * @internal
42
- */ function createUseQueries(client) {
43
- return shared.createRecursiveProxy((opts)=>{
44
- const arrayPath = opts.path;
45
- const dotPath = arrayPath.join('.');
46
- const [input, _opts] = opts.args;
47
- const options = {
48
- queryKey: utilsProxy.getQueryKeyInternal(arrayPath, input, 'query'),
49
- queryFn: ()=>{
50
- return client.query(dotPath, input, _opts?.trpc);
51
- },
52
- ..._opts
53
- };
54
- return options;
13
+ function _interopNamespaceDefault(e) {
14
+ var n = Object.create(null);
15
+ if (e) {
16
+ Object.keys(e).forEach(function (k) {
17
+ if (k !== 'default') {
18
+ var d = Object.getOwnPropertyDescriptor(e, k);
19
+ Object.defineProperty(n, k, d.get ? d : {
20
+ enumerable: true,
21
+ get: function () { return e[k]; }
22
+ });
23
+ }
55
24
  });
25
+ }
26
+ n.default = e;
27
+ return Object.freeze(n);
56
28
  }
57
29
 
58
- function getClientArgs(queryKey, opts, pageParam) {
59
- const path = queryKey[0];
60
- const input = queryKey[1]?.input;
61
- if (pageParam) input.cursor = pageParam;
62
- return [
63
- path.join('.'),
64
- input,
65
- opts?.trpc
66
- ];
67
- }
68
-
69
- /**
70
- * Makes a stable reference of the `trpc` prop
71
- */ function useHookResult(value) {
72
- const ref = React.useRef(value);
73
- ref.current.path = value.path;
74
- return ref.current;
75
- }
30
+ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
76
31
 
77
32
  /**
78
33
  * @internal
79
34
  */ function createRootHooks(config) {
80
35
  const mutationSuccessOverride = config?.overrides?.useMutation?.onSuccess ?? ((options)=>options.originalFn());
81
- const Context = config?.context ?? utilsProxy.TRPCContext;
36
+ const Context = config?.context ?? context.TRPCContext;
82
37
  const createClient = (opts)=>{
83
38
  return client.createTRPCUntypedClient(opts);
84
39
  };
85
40
  const TRPCProvider = (props)=>{
86
41
  const { abortOnUnmount =false , client , queryClient , ssrContext } = props;
87
- const [ssrState, setSSRState] = React.useState(props.ssrState ?? false);
88
- React.useEffect(()=>{
89
- // Only updating state to `mounted` if we are using SSR.
90
- // This makes it so we don't have an unnecessary re-render when opting out of SSR.
91
- setSSRState((state)=>state ? 'mounted' : false);
92
- }, []);
93
- return /*#__PURE__*/ React__default["default"].createElement(Context.Provider, {
94
- value: {
42
+ const [ssrState, setSSRState] = React__namespace.useState(props.ssrState ?? false);
43
+ const fns = React__namespace.useMemo(()=>createUtilityFunctions.createUtilityFunctions({
44
+ client,
45
+ queryClient
46
+ }), [
47
+ client,
48
+ queryClient
49
+ ]);
50
+ const contextValue = React__namespace.useMemo(()=>({
95
51
  abortOnUnmount,
96
52
  queryClient,
97
53
  client,
98
54
  ssrContext: ssrContext ?? null,
99
55
  ssrState,
100
- fetchQuery: React.useCallback((queryKey, opts)=>{
101
- return queryClient.fetchQuery({
102
- ...opts,
103
- queryKey,
104
- queryFn: ()=>client.query(...getClientArgs(queryKey, opts))
105
- });
106
- }, [
107
- client,
108
- queryClient
109
- ]),
110
- fetchInfiniteQuery: React.useCallback((queryKey, opts)=>{
111
- return queryClient.fetchInfiniteQuery({
112
- ...opts,
113
- queryKey,
114
- queryFn: ({ pageParam })=>{
115
- return client.query(...getClientArgs(queryKey, opts, pageParam));
116
- },
117
- initialPageParam: opts?.initialCursor ?? null
118
- });
119
- }, [
120
- client,
121
- queryClient
122
- ]),
123
- prefetchQuery: React.useCallback((queryKey, opts)=>{
124
- return queryClient.prefetchQuery({
125
- ...opts,
126
- queryKey,
127
- queryFn: ()=>client.query(...getClientArgs(queryKey, opts))
128
- });
129
- }, [
130
- client,
131
- queryClient
132
- ]),
133
- prefetchInfiniteQuery: React.useCallback((queryKey, opts)=>{
134
- return queryClient.prefetchInfiniteQuery({
135
- ...opts,
136
- queryKey,
137
- queryFn: ({ pageParam })=>{
138
- return client.query(...getClientArgs(queryKey, opts, pageParam));
139
- },
140
- initialPageParam: opts?.initialCursor ?? null
141
- });
142
- }, [
143
- client,
144
- queryClient
145
- ]),
146
- ensureQueryData: React.useCallback((queryKey, opts)=>{
147
- return queryClient.ensureQueryData({
148
- ...opts,
149
- queryKey,
150
- queryFn: ()=>client.query(...getClientArgs(queryKey, opts))
151
- });
152
- }, [
153
- client,
154
- queryClient
155
- ]),
156
- invalidateQueries: React.useCallback((queryKey, filters, options)=>{
157
- return queryClient.invalidateQueries({
158
- ...filters,
159
- queryKey
160
- }, options);
161
- }, [
162
- queryClient
163
- ]),
164
- resetQueries: React.useCallback((queryKey, filters, options)=>{
165
- return queryClient.resetQueries({
166
- ...filters,
167
- queryKey
168
- }, options);
169
- }, [
170
- queryClient
171
- ]),
172
- refetchQueries: React.useCallback((queryKey, filters, options)=>{
173
- return queryClient.refetchQueries({
174
- ...filters,
175
- queryKey
176
- }, options);
177
- }, [
178
- queryClient
179
- ]),
180
- cancelQuery: React.useCallback((queryKey, options)=>{
181
- return queryClient.cancelQueries({
182
- queryKey
183
- }, options);
184
- }, [
185
- queryClient
186
- ]),
187
- setQueryData: React.useCallback((queryKey, updater, options)=>{
188
- return queryClient.setQueryData(queryKey, updater, options);
189
- }, [
190
- queryClient
191
- ]),
192
- getQueryData: React.useCallback((queryKey)=>{
193
- return queryClient.getQueryData(queryKey);
194
- }, [
195
- queryClient
196
- ]),
197
- setInfiniteQueryData: React.useCallback((queryKey, updater, options)=>{
198
- return queryClient.setQueryData(queryKey, updater, options);
199
- }, [
200
- queryClient
201
- ]),
202
- getInfiniteQueryData: React.useCallback((queryKey)=>{
203
- return queryClient.getQueryData(queryKey);
204
- }, [
205
- queryClient
206
- ])
207
- }
56
+ ...fns
57
+ }), [
58
+ abortOnUnmount,
59
+ client,
60
+ fns,
61
+ queryClient,
62
+ ssrContext,
63
+ ssrState
64
+ ]);
65
+ React__namespace.useEffect(()=>{
66
+ // Only updating state to `mounted` if we are using SSR.
67
+ // This makes it so we don't have an unnecessary re-render when opting out of SSR.
68
+ setSSRState((state)=>state ? 'mounted' : false);
69
+ }, []);
70
+ return /*#__PURE__*/ React__namespace.createElement(Context.Provider, {
71
+ value: contextValue
208
72
  }, props.children);
209
73
  };
210
74
  function useContext() {
211
- const context = React__default["default"].useContext(Context);
75
+ const context = React__namespace.useContext(Context);
212
76
  if (!context) {
213
77
  throw new Error('Unable to find tRPC Context. Did you forget to wrap your App inside `withTRPC` HoC?');
214
78
  }
@@ -229,9 +93,10 @@ function getClientArgs(queryKey, opts, pageParam) {
229
93
  function useQuery(path, input, opts) {
230
94
  const context = useContext();
231
95
  const { abortOnUnmount , client , ssrState , queryClient , prefetchQuery } = context;
232
- const queryKey = utilsProxy.getQueryKeyInternal(path, input, 'query');
96
+ const queryKey = getQueryKey.getQueryKeyInternal(path, input, 'query');
233
97
  const defaultOpts = queryClient.getQueryDefaults(queryKey);
234
- if (typeof window === 'undefined' && ssrState === 'prepass' && opts?.trpc?.ssr !== false && (opts?.enabled ?? defaultOpts?.enabled) !== false && !queryClient.getQueryCache().find({
98
+ const isInputSkipToken = input === reactQuery.skipToken;
99
+ if (typeof window === 'undefined' && ssrState === 'prepass' && opts?.trpc?.ssr !== false && (opts?.enabled ?? defaultOpts?.enabled) !== false && !isInputSkipToken && !queryClient.getQueryCache().find({
235
100
  queryKey
236
101
  })) {
237
102
  void prefetchQuery(queryKey, opts);
@@ -244,7 +109,7 @@ function getClientArgs(queryKey, opts, pageParam) {
244
109
  const hook = reactQuery.useQuery({
245
110
  ...ssrOpts,
246
111
  queryKey: queryKey,
247
- queryFn: (queryFunctionContext)=>{
112
+ queryFn: isInputSkipToken ? input : (queryFunctionContext)=>{
248
113
  const actualOpts = {
249
114
  ...ssrOpts,
250
115
  trpc: {
@@ -254,17 +119,17 @@ function getClientArgs(queryKey, opts, pageParam) {
254
119
  } : {}
255
120
  }
256
121
  };
257
- return client.query(...getClientArgs(queryKey, actualOpts));
122
+ return client.query(...getClientArgs.getClientArgs(queryKey, actualOpts));
258
123
  }
259
124
  }, queryClient);
260
- hook.trpc = useHookResult({
261
- path: path.join('.')
125
+ hook.trpc = useHookResult.useHookResult({
126
+ path
262
127
  });
263
128
  return hook;
264
129
  }
265
130
  function useSuspenseQuery(path, input, opts) {
266
131
  const context = useContext();
267
- const queryKey = utilsProxy.getQueryKeyInternal(path, input, 'query');
132
+ const queryKey = getQueryKey.getQueryKeyInternal(path, input, 'query');
268
133
  const shouldAbortOnUnmount = opts?.trpc?.abortOnUnmount ?? config?.abortOnUnmount ?? context.abortOnUnmount;
269
134
  const hook = reactQuery.useSuspenseQuery({
270
135
  ...opts,
@@ -277,11 +142,11 @@ function getClientArgs(queryKey, opts, pageParam) {
277
142
  } : {}
278
143
  }
279
144
  };
280
- return context.client.query(...getClientArgs(queryKey, actualOpts));
145
+ return context.client.query(...getClientArgs.getClientArgs(queryKey, actualOpts));
281
146
  }
282
147
  }, context.queryClient);
283
- hook.trpc = useHookResult({
284
- path: path.join('.')
148
+ hook.trpc = useHookResult.useHookResult({
149
+ path
285
150
  });
286
151
  return [
287
152
  hook.data,
@@ -299,7 +164,7 @@ function getClientArgs(queryKey, opts, pageParam) {
299
164
  ...opts,
300
165
  mutationKey: mutationKey,
301
166
  mutationFn: (input)=>{
302
- return client.mutation(...getClientArgs([
167
+ return client.mutation(...getClientArgs.getClientArgs([
303
168
  path,
304
169
  {
305
170
  input
@@ -315,18 +180,18 @@ function getClientArgs(queryKey, opts, pageParam) {
315
180
  });
316
181
  }
317
182
  }, queryClient);
318
- hook.trpc = useHookResult({
319
- path: path.join('.')
183
+ hook.trpc = useHookResult.useHookResult({
184
+ path
320
185
  });
321
186
  return hook;
322
187
  }
323
188
  /* istanbul ignore next -- @preserve */ function useSubscription(path, input, opts) {
324
189
  const enabled = opts?.enabled ?? true;
325
- const queryKey = reactQuery.hashKey(utilsProxy.getQueryKeyInternal(path, input, 'any'));
190
+ const queryKey = reactQuery.hashKey(getQueryKey.getQueryKeyInternal(path, input, 'any'));
326
191
  const { client } = useContext();
327
- const optsRef = React.useRef(opts);
192
+ const optsRef = React__namespace.useRef(opts);
328
193
  optsRef.current = opts;
329
- React.useEffect(()=>{
194
+ React__namespace.useEffect(()=>{
330
195
  if (!enabled) {
331
196
  return;
332
197
  }
@@ -360,9 +225,10 @@ function getClientArgs(queryKey, opts, pageParam) {
360
225
  }
361
226
  function useInfiniteQuery(path, input, opts) {
362
227
  const { client , ssrState , prefetchInfiniteQuery , queryClient , abortOnUnmount , } = useContext();
363
- const queryKey = utilsProxy.getQueryKeyInternal(path, input, 'infinite');
228
+ const queryKey = getQueryKey.getQueryKeyInternal(path, input, 'infinite');
364
229
  const defaultOpts = queryClient.getQueryDefaults(queryKey);
365
- if (typeof window === 'undefined' && ssrState === 'prepass' && opts?.trpc?.ssr !== false && (opts?.enabled ?? defaultOpts?.enabled) !== false && !queryClient.getQueryCache().find({
230
+ const isInputSkipToken = input === reactQuery.skipToken;
231
+ if (typeof window === 'undefined' && ssrState === 'prepass' && opts?.trpc?.ssr !== false && (opts?.enabled ?? defaultOpts?.enabled) !== false && !isInputSkipToken && !queryClient.getQueryCache().find({
366
232
  queryKey
367
233
  })) {
368
234
  void prefetchInfiniteQuery(queryKey, {
@@ -381,7 +247,7 @@ function getClientArgs(queryKey, opts, pageParam) {
381
247
  initialPageParam: opts.initialCursor ?? null,
382
248
  persister: opts.persister,
383
249
  queryKey: queryKey,
384
- queryFn: (queryFunctionContext)=>{
250
+ queryFn: isInputSkipToken ? input : (queryFunctionContext)=>{
385
251
  const actualOpts = {
386
252
  ...ssrOpts,
387
253
  trpc: {
@@ -391,17 +257,20 @@ function getClientArgs(queryKey, opts, pageParam) {
391
257
  } : {}
392
258
  }
393
259
  };
394
- return client.query(...getClientArgs(queryKey, actualOpts, queryFunctionContext.pageParam ?? opts.initialCursor));
260
+ return client.query(...getClientArgs.getClientArgs(queryKey, actualOpts, {
261
+ pageParam: queryFunctionContext.pageParam ?? opts.initialCursor,
262
+ direction: queryFunctionContext.direction
263
+ }));
395
264
  }
396
265
  }, queryClient);
397
- hook.trpc = useHookResult({
398
- path: path.join('.')
266
+ hook.trpc = useHookResult.useHookResult({
267
+ path
399
268
  });
400
269
  return hook;
401
270
  }
402
271
  function useSuspenseInfiniteQuery(path, input, opts) {
403
272
  const context = useContext();
404
- const queryKey = utilsProxy.getQueryKeyInternal(path, input, 'infinite');
273
+ const queryKey = getQueryKey.getQueryKeyInternal(path, input, 'infinite');
405
274
  const defaultOpts = context.queryClient.getQueryDefaults(queryKey);
406
275
  const ssrOpts = useSSRQueryOptionsIfNeeded(queryKey, {
407
276
  ...defaultOpts,
@@ -423,11 +292,14 @@ function getClientArgs(queryKey, opts, pageParam) {
423
292
  } : {}
424
293
  }
425
294
  };
426
- return context.client.query(...getClientArgs(queryKey, actualOpts, queryFunctionContext.pageParam ?? opts.initialCursor));
295
+ return context.client.query(...getClientArgs.getClientArgs(queryKey, actualOpts, {
296
+ pageParam: queryFunctionContext.pageParam ?? opts.initialCursor,
297
+ direction: queryFunctionContext.direction
298
+ }));
427
299
  }
428
300
  }, context.queryClient);
429
- hook.trpc = useHookResult({
430
- path: path.join('.')
301
+ hook.trpc = useHookResult.useHookResult({
302
+ path
431
303
  });
432
304
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
433
305
  return [
@@ -437,7 +309,7 @@ function getClientArgs(queryKey, opts, pageParam) {
437
309
  }
438
310
  const useQueries = (queriesCallback)=>{
439
311
  const { ssrState , queryClient , prefetchQuery , client } = useContext();
440
- const proxy = createUseQueries(client);
312
+ const proxy = useQueriesProxy.createUseQueries(client);
441
313
  const queries = queriesCallback(proxy);
442
314
  if (typeof window === 'undefined' && ssrState === 'prepass') {
443
315
  for (const query of queries){
@@ -456,17 +328,20 @@ function getClientArgs(queryKey, opts, pageParam) {
456
328
  }))
457
329
  }, queryClient);
458
330
  };
459
- const useDehydratedState = (client, trpcState)=>{
460
- const transformed = React.useMemo(()=>{
461
- if (!trpcState) {
462
- return trpcState;
463
- }
464
- return client.runtime.transformer.deserialize(trpcState);
465
- }, [
466
- trpcState,
467
- client
468
- ]);
469
- return transformed;
331
+ const useSuspenseQueries = (queriesCallback)=>{
332
+ const { queryClient , client } = useContext();
333
+ const proxy = useQueriesProxy.createUseQueries(client);
334
+ const queries = queriesCallback(proxy);
335
+ const hook = reactQuery.useSuspenseQueries({
336
+ queries: queries.map((query)=>({
337
+ ...query,
338
+ queryKey: query.queryKey
339
+ }))
340
+ }, queryClient);
341
+ return [
342
+ hook.map((h)=>h.data),
343
+ hook
344
+ ];
470
345
  };
471
346
  return {
472
347
  Provider: TRPCProvider,
@@ -476,15 +351,12 @@ function getClientArgs(queryKey, opts, pageParam) {
476
351
  useQuery,
477
352
  useSuspenseQuery,
478
353
  useQueries,
354
+ useSuspenseQueries,
479
355
  useMutation,
480
356
  useSubscription,
481
- useDehydratedState,
482
357
  useInfiniteQuery,
483
358
  useSuspenseInfiniteQuery
484
359
  };
485
360
  }
486
361
 
487
- exports.createReactDecoration = createReactDecoration;
488
362
  exports.createRootHooks = createRootHooks;
489
- exports.createUseQueries = createUseQueries;
490
- exports.getClientArgs = getClientArgs;