@trpc/react-query 11.0.0-alpha-tmp-02-21-concat.302 → 11.0.0-alpha-tmp-issues-4129-lazy-routers.302
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/dist/bundle-analysis.json +33 -33
- package/dist/createTRPCReact.d.ts +3 -2
- package/dist/createTRPCReact.d.ts.map +1 -1
- package/dist/internals/getClientArgs.d.ts +4 -1
- package/dist/internals/getClientArgs.d.ts.map +1 -1
- package/dist/internals/getClientArgs.js +6 -3
- package/dist/internals/getClientArgs.mjs +6 -3
- package/dist/internals/getQueryKey.d.ts +2 -2
- package/dist/internals/getQueryKey.d.ts.map +1 -1
- package/dist/internals/getQueryKey.js +5 -3
- package/dist/internals/getQueryKey.mjs +5 -3
- package/dist/server/ssgProxy.js +1 -1
- package/dist/server/ssgProxy.mjs +1 -1
- package/dist/shared/hooks/createHooksInternal.d.ts.map +1 -1
- package/dist/shared/hooks/createHooksInternal.js +8 -2
- package/dist/shared/hooks/createHooksInternal.mjs +8 -2
- package/dist/shared/polymorphism/routerLike.d.ts +1 -1
- package/dist/shared/polymorphism/routerLike.d.ts.map +1 -1
- package/dist/utils/createUtilityFunctions.js +10 -4
- package/dist/utils/createUtilityFunctions.mjs +10 -4
- package/package.json +6 -6
- package/src/createTRPCReact.tsx +3 -2
- package/src/internals/getClientArgs.ts +7 -3
- package/src/internals/getQueryKey.ts +18 -10
- package/src/server/ssgProxy.ts +1 -1
- package/src/shared/hooks/createHooksInternal.tsx +8 -10
- package/src/shared/polymorphism/routerLike.ts +1 -1
- package/src/utils/createUtilityFunctions.ts +4 -4
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
-
"bundleSize":
|
|
3
|
-
"bundleOrigSize":
|
|
4
|
-
"bundleReduction": 54.
|
|
2
|
+
"bundleSize": 27855,
|
|
3
|
+
"bundleOrigSize": 60718,
|
|
4
|
+
"bundleReduction": 54.12,
|
|
5
5
|
"modules": [
|
|
6
6
|
{
|
|
7
7
|
"id": "/src/shared/hooks/createHooksInternal.tsx",
|
|
8
|
-
"size":
|
|
9
|
-
"origSize":
|
|
8
|
+
"size": 12600,
|
|
9
|
+
"origSize": 14488,
|
|
10
10
|
"renderedExports": [
|
|
11
11
|
"createRootHooks"
|
|
12
12
|
],
|
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
"dependents": [
|
|
15
15
|
"/src/createTRPCReact.tsx"
|
|
16
16
|
],
|
|
17
|
-
"percent": 45.
|
|
18
|
-
"reduction":
|
|
17
|
+
"percent": 45.23,
|
|
18
|
+
"reduction": 13.03
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
21
|
"id": "/src/server/ssgProxy.ts",
|
|
22
|
-
"size":
|
|
23
|
-
"origSize":
|
|
22
|
+
"size": 3656,
|
|
23
|
+
"origSize": 7386,
|
|
24
24
|
"renderedExports": [
|
|
25
25
|
"createServerSideHelpers"
|
|
26
26
|
],
|
|
@@ -28,13 +28,13 @@
|
|
|
28
28
|
"dependents": [
|
|
29
29
|
"/src/server/index.ts"
|
|
30
30
|
],
|
|
31
|
-
"percent": 13.
|
|
32
|
-
"reduction": 50.
|
|
31
|
+
"percent": 13.13,
|
|
32
|
+
"reduction": 50.5
|
|
33
33
|
},
|
|
34
34
|
{
|
|
35
35
|
"id": "/src/utils/createUtilityFunctions.ts",
|
|
36
|
-
"size":
|
|
37
|
-
"origSize":
|
|
36
|
+
"size": 3524,
|
|
37
|
+
"origSize": 3777,
|
|
38
38
|
"renderedExports": [
|
|
39
39
|
"createUtilityFunctions"
|
|
40
40
|
],
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
"/src/createTRPCQueryUtils.tsx",
|
|
44
44
|
"/src/shared/hooks/createHooksInternal.tsx"
|
|
45
45
|
],
|
|
46
|
-
"percent": 12.
|
|
47
|
-
"reduction":
|
|
46
|
+
"percent": 12.65,
|
|
47
|
+
"reduction": 6.7
|
|
48
48
|
},
|
|
49
49
|
{
|
|
50
50
|
"id": "/src/shared/proxy/utilsProxy.ts",
|
|
@@ -59,13 +59,13 @@
|
|
|
59
59
|
"dependents": [
|
|
60
60
|
"/src/shared/index.ts"
|
|
61
61
|
],
|
|
62
|
-
"percent":
|
|
62
|
+
"percent": 9.85,
|
|
63
63
|
"reduction": 73.94
|
|
64
64
|
},
|
|
65
65
|
{
|
|
66
66
|
"id": "/src/internals/getQueryKey.ts",
|
|
67
|
-
"size":
|
|
68
|
-
"origSize":
|
|
67
|
+
"size": 1965,
|
|
68
|
+
"origSize": 3394,
|
|
69
69
|
"renderedExports": [
|
|
70
70
|
"getQueryKeyInternal",
|
|
71
71
|
"getQueryKey"
|
|
@@ -78,13 +78,13 @@
|
|
|
78
78
|
"/src/shared/proxy/useQueriesProxy.ts",
|
|
79
79
|
"/src/shared/hooks/createHooksInternal.tsx"
|
|
80
80
|
],
|
|
81
|
-
"percent":
|
|
82
|
-
"reduction":
|
|
81
|
+
"percent": 7.05,
|
|
82
|
+
"reduction": 42.1
|
|
83
83
|
},
|
|
84
84
|
{
|
|
85
85
|
"id": "/src/createTRPCReact.tsx",
|
|
86
86
|
"size": 850,
|
|
87
|
-
"origSize":
|
|
87
|
+
"origSize": 7837,
|
|
88
88
|
"renderedExports": [
|
|
89
89
|
"createHooksInternal",
|
|
90
90
|
"createTRPCReact"
|
|
@@ -93,8 +93,8 @@
|
|
|
93
93
|
"dependents": [
|
|
94
94
|
"/src/index.ts"
|
|
95
95
|
],
|
|
96
|
-
"percent": 3.
|
|
97
|
-
"reduction": 89.
|
|
96
|
+
"percent": 3.05,
|
|
97
|
+
"reduction": 89.15
|
|
98
98
|
},
|
|
99
99
|
{
|
|
100
100
|
"id": "/src/shared/proxy/decorationProxy.ts",
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
"dependents": [
|
|
108
108
|
"/src/shared/index.ts"
|
|
109
109
|
],
|
|
110
|
-
"percent": 2.
|
|
110
|
+
"percent": 2.89,
|
|
111
111
|
"reduction": 23.16
|
|
112
112
|
},
|
|
113
113
|
{
|
|
@@ -122,13 +122,13 @@
|
|
|
122
122
|
"/src/shared/index.ts",
|
|
123
123
|
"/src/shared/hooks/createHooksInternal.tsx"
|
|
124
124
|
],
|
|
125
|
-
"percent": 2.
|
|
125
|
+
"percent": 2.04,
|
|
126
126
|
"reduction": 82.03
|
|
127
127
|
},
|
|
128
128
|
{
|
|
129
129
|
"id": "/src/internals/getClientArgs.ts",
|
|
130
|
-
"size":
|
|
131
|
-
"origSize":
|
|
130
|
+
"size": 473,
|
|
131
|
+
"origSize": 572,
|
|
132
132
|
"renderedExports": [
|
|
133
133
|
"getClientArgs"
|
|
134
134
|
],
|
|
@@ -138,8 +138,8 @@
|
|
|
138
138
|
"/src/shared/hooks/createHooksInternal.tsx",
|
|
139
139
|
"/src/utils/createUtilityFunctions.ts"
|
|
140
140
|
],
|
|
141
|
-
"percent": 1.
|
|
142
|
-
"reduction": 17.
|
|
141
|
+
"percent": 1.7,
|
|
142
|
+
"reduction": 17.31
|
|
143
143
|
},
|
|
144
144
|
{
|
|
145
145
|
"id": "/src/internals/useHookResult.ts",
|
|
@@ -152,7 +152,7 @@
|
|
|
152
152
|
"dependents": [
|
|
153
153
|
"/src/shared/hooks/createHooksInternal.tsx"
|
|
154
154
|
],
|
|
155
|
-
"percent": 0.
|
|
155
|
+
"percent": 0.8,
|
|
156
156
|
"reduction": 36.21
|
|
157
157
|
},
|
|
158
158
|
{
|
|
@@ -166,7 +166,7 @@
|
|
|
166
166
|
"dependents": [
|
|
167
167
|
"/src/index.ts"
|
|
168
168
|
],
|
|
169
|
-
"percent": 0.
|
|
169
|
+
"percent": 0.58,
|
|
170
170
|
"reduction": 66.6
|
|
171
171
|
},
|
|
172
172
|
{
|
|
@@ -184,7 +184,7 @@
|
|
|
184
184
|
"/src/shared/proxy/utilsProxy.ts",
|
|
185
185
|
"/src/shared/hooks/createHooksInternal.tsx"
|
|
186
186
|
],
|
|
187
|
-
"percent": 0.
|
|
187
|
+
"percent": 0.55,
|
|
188
188
|
"reduction": 97.47
|
|
189
189
|
},
|
|
190
190
|
{
|
|
@@ -198,7 +198,7 @@
|
|
|
198
198
|
"dependents": [
|
|
199
199
|
"/src/shared/index.ts"
|
|
200
200
|
],
|
|
201
|
-
"percent": 0.
|
|
201
|
+
"percent": 0.46,
|
|
202
202
|
"reduction": 74.9
|
|
203
203
|
},
|
|
204
204
|
{
|
|
@@ -30,6 +30,7 @@ export interface ProcedureUseQuery<TDef extends ResolverDef> {
|
|
|
30
30
|
type CursorInput = {
|
|
31
31
|
cursor?: any;
|
|
32
32
|
} | void;
|
|
33
|
+
type ReservedInfiniteQueryKeys = 'cursor' | 'direction';
|
|
33
34
|
/**
|
|
34
35
|
* @internal
|
|
35
36
|
*/
|
|
@@ -37,11 +38,11 @@ export type MaybeDecoratedInfiniteQuery<TDef extends ResolverDef> = TDef['input'
|
|
|
37
38
|
/**
|
|
38
39
|
* @link https://trpc.io/docs/v11/client/react/suspense#useinfinitesuspensequery
|
|
39
40
|
*/
|
|
40
|
-
useInfiniteQuery: (input: Omit<TDef['input'],
|
|
41
|
+
useInfiniteQuery: (input: Omit<TDef['input'], ReservedInfiniteQueryKeys>, opts: UseTRPCInfiniteQueryOptions<TDef['input'], TDef['output'], TRPCClientErrorLike<TDef>>) => UseTRPCInfiniteQueryResult<TDef['output'], TRPCClientErrorLike<TDef>, TDef['input']>;
|
|
41
42
|
/**
|
|
42
43
|
* @link https://trpc.io/docs/v11/client/react/suspense
|
|
43
44
|
*/
|
|
44
|
-
useSuspenseInfiniteQuery: (input: Omit<TDef['input'], 'cursor'>, opts: UseTRPCSuspenseInfiniteQueryOptions<TDef['input'], TDef['output'], TRPCClientErrorLike<TDef>>) => UseTRPCSuspenseInfiniteQueryResult<TDef['output'], TRPCClientErrorLike<TDef>, TDef['input']>;
|
|
45
|
+
useSuspenseInfiniteQuery: (input: Omit<TDef['input'], 'cursor' | 'direction'>, opts: UseTRPCSuspenseInfiniteQueryOptions<TDef['input'], TDef['output'], TRPCClientErrorLike<TDef>>) => UseTRPCSuspenseInfiniteQueryResult<TDef['output'], TRPCClientErrorLike<TDef>, TDef['input']>;
|
|
45
46
|
} : object;
|
|
46
47
|
/**
|
|
47
48
|
* @internal
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createTRPCReact.d.ts","sourceRoot":"","sources":["../src/createTRPCReact.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,KAAK,EACV,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,mBAAmB,EACnB,+BAA+B,EAC/B,aAAa,EACb,qBAAqB,EACrB,YAAY,EACb,MAAM,0CAA0C,CAAC;AAGlD,OAAO,KAAK,EACV,cAAc,EACd,sBAAsB,EACvB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEjD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAEhF,OAAO,KAAK,EACV,YAAY,EACZ,0BAA0B,EAC1B,yBAAyB,EACzB,YAAY,EACZ,2BAA2B,EAC3B,0BAA0B,EAC1B,sBAAsB,EACtB,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,EAClB,0BAA0B,EAC1B,mCAAmC,EACnC,kCAAkC,EAClC,2BAA2B,EAC3B,0BAA0B,EAC3B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAE7D,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,GAAG,CAAC;IACX,MAAM,EAAE,GAAG,CAAC;IACZ,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,GAAG,CAAC;CACjB,CAAC;AACF;;GAEG;AACH,MAAM,WAAW,iBAAiB,CAAC,IAAI,SAAS,WAAW;IACzD,CAAC,YAAY,SAAS,IAAI,CAAC,QAAQ,CAA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AAgB,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;IACrD;;OAEG;IACH,QAAQ,IAAI,gBAAgB,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;IACnD,QAAQ,EAAE,YAAY,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;IAC7C,YAAY,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC;IACpC,UAAU,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC;IACpC,kBAAkB,EAAE,sBAAsB,CAAC,OAAO,CAAC,CAAC;CACrD,CAAC;AAEF,MAAM,MAAM,eAAe,CACzB,OAAO,SAAS,SAAS,EACzB,WAAW,IACT,qBAAqB,CACvB,mBAAmB,CAAC,OAAO,EAAE,WAAW,CAAC,EACzC,oBAAoB,CAClB,OAAO,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,EACpC,OAAO,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAC1B,CACF,CAAC;AAEF;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,SAAS,SAAS,EACzB,WAAW,GAAG,OAAO,EACrB,IAAI,EAAE,qBAAqB,CAAC,OAAO,EAAE,WAAW,CAAC,2JAoBlD;AAED,wBAAgB,eAAe,CAC7B,OAAO,SAAS,SAAS,EACzB,WAAW,GAAG,OAAO,EAErB,IAAI,CAAC,EAAE,sBAAsB,CAAC,OAAO,CAAC,GACrC,eAAe,CAAC,OAAO,EAAE,WAAW,CAAC,CAKvC"}
|
|
@@ -2,5 +2,8 @@ import type { TRPCQueryKey } from './getQueryKey';
|
|
|
2
2
|
/**
|
|
3
3
|
* @internal
|
|
4
4
|
*/
|
|
5
|
-
export declare function getClientArgs<TOptions>(queryKey: TRPCQueryKey, opts: TOptions,
|
|
5
|
+
export declare function getClientArgs<TOptions>(queryKey: TRPCQueryKey, opts: TOptions, infiniteParams?: {
|
|
6
|
+
pageParam: any;
|
|
7
|
+
direction: 'forward' | 'backward';
|
|
8
|
+
}): readonly [string, unknown, any];
|
|
6
9
|
//# sourceMappingURL=getClientArgs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getClientArgs.d.ts","sourceRoot":"","sources":["../../src/internals/getClientArgs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAElD;;GAEG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EACpC,QAAQ,EAAE,YAAY,EACtB,IAAI,EAAE,QAAQ,EACd,SAAS,CAAC,EAAE,GAAG,
|
|
1
|
+
{"version":3,"file":"getClientArgs.d.ts","sourceRoot":"","sources":["../../src/internals/getClientArgs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAElD;;GAEG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EACpC,QAAQ,EAAE,YAAY,EACtB,IAAI,EAAE,QAAQ,EACd,cAAc,CAAC,EAAE;IACf,SAAS,EAAE,GAAG,CAAC;IACf,SAAS,EAAE,SAAS,GAAG,UAAU,CAAC;CACnC,mCAYF"}
|
|
@@ -2,13 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @internal
|
|
5
|
-
*/ function getClientArgs(queryKey, opts,
|
|
5
|
+
*/ function getClientArgs(queryKey, opts, infiniteParams) {
|
|
6
6
|
const path = queryKey[0];
|
|
7
7
|
let input = queryKey[1]?.input;
|
|
8
|
-
if (
|
|
8
|
+
if (infiniteParams) {
|
|
9
9
|
input = {
|
|
10
10
|
...input ?? {},
|
|
11
|
-
|
|
11
|
+
...infiniteParams.pageParam ? {
|
|
12
|
+
cursor: infiniteParams.pageParam
|
|
13
|
+
} : {},
|
|
14
|
+
direction: infiniteParams.direction
|
|
12
15
|
};
|
|
13
16
|
}
|
|
14
17
|
return [
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @internal
|
|
3
|
-
*/ function getClientArgs(queryKey, opts,
|
|
3
|
+
*/ function getClientArgs(queryKey, opts, infiniteParams) {
|
|
4
4
|
const path = queryKey[0];
|
|
5
5
|
let input = queryKey[1]?.input;
|
|
6
|
-
if (
|
|
6
|
+
if (infiniteParams) {
|
|
7
7
|
input = {
|
|
8
8
|
...input ?? {},
|
|
9
|
-
|
|
9
|
+
...infiniteParams.pageParam ? {
|
|
10
|
+
cursor: infiniteParams.pageParam
|
|
11
|
+
} : {},
|
|
12
|
+
direction: infiniteParams.direction
|
|
10
13
|
};
|
|
11
14
|
}
|
|
12
15
|
return [
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type DeepPartial } from '@trpc/server/unstable-core-do-not-import';
|
|
2
2
|
import type { DecoratedMutation, DecoratedQuery } from '../createTRPCReact';
|
|
3
3
|
import type { DecorateRouterRecord } from '../shared';
|
|
4
4
|
export type QueryType = 'any' | 'infinite' | 'query';
|
|
@@ -16,7 +16,7 @@ type ProcedureOrRouter = DecoratedMutation<any> | DecoratedQuery<any> | Decorate
|
|
|
16
16
|
* storing in tanstack query.
|
|
17
17
|
**/
|
|
18
18
|
export declare function getQueryKeyInternal(path: string[], input: unknown, type: QueryType): TRPCQueryKey;
|
|
19
|
-
type GetInfiniteQueryInput<TProcedureInput,
|
|
19
|
+
type GetInfiniteQueryInput<TProcedureInput, TInputWithoutCursorAndDirection = Omit<TProcedureInput, 'cursor' | 'direction'>> = keyof TInputWithoutCursorAndDirection extends never ? undefined : DeepPartial<TInputWithoutCursorAndDirection> | undefined;
|
|
20
20
|
/** @internal */
|
|
21
21
|
export type GetQueryProcedureInput<TProcedureInput> = TProcedureInput extends {
|
|
22
22
|
cursor?: any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getQueryKey.d.ts","sourceRoot":"","sources":["../../src/internals/getQueryKey.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"getQueryKey.d.ts","sourceRoot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AAC,KAAK,CAAC,EAAE,sBAAsB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,SAAS,CAAC,GACjE,EAAE,CAAC;AAET;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,kBAAkB,SAAS,iBAAiB,EACtE,iBAAiB,EAAE,kBAAkB,EACrC,GAAG,OAAO,EAAE,SAAS,CAAC,kBAAkB,CAAC,gBAQ1C;AAGD,MAAM,MAAM,aAAa,CAAC,MAAM,EAAE,KAAK,SAAS,OAAO,CAAC,SAAS,EAAE,KAAK,CAAC,IAAI;IAC3E,MAAM,EAAE;IACR;QAAE,KAAK,CAAC,EAAE,sBAAsB,CAAC,MAAM,CAAC,CAAC;QAAC,IAAI,EAAE,KAAK,CAAA;KAAE,CAAC;CACzD,CAAC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var unstableCoreDoNotImport = require('@trpc/server/unstable-core-do-not-import');
|
|
4
|
+
|
|
3
5
|
/**
|
|
4
6
|
* To allow easy interactions with groups of related queries, such as
|
|
5
7
|
* invalidating all queries of a router, we use an array as the path when
|
|
@@ -17,12 +19,12 @@
|
|
|
17
19
|
splitPath
|
|
18
20
|
] : [];
|
|
19
21
|
}
|
|
20
|
-
if (type === 'infinite' && input &&
|
|
21
|
-
const { cursor: _ , ...
|
|
22
|
+
if (type === 'infinite' && unstableCoreDoNotImport.isObject(input) && ('direction' in input || 'cursor' in input)) {
|
|
23
|
+
const { cursor: _ , direction: __ , ...inputWithoutCursorAndDirection } = input;
|
|
22
24
|
return [
|
|
23
25
|
splitPath,
|
|
24
26
|
{
|
|
25
|
-
input:
|
|
27
|
+
input: inputWithoutCursorAndDirection,
|
|
26
28
|
type: 'infinite'
|
|
27
29
|
}
|
|
28
30
|
];
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { isObject } from '@trpc/server/unstable-core-do-not-import';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* To allow easy interactions with groups of related queries, such as
|
|
3
5
|
* invalidating all queries of a router, we use an array as the path when
|
|
@@ -15,12 +17,12 @@
|
|
|
15
17
|
splitPath
|
|
16
18
|
] : [];
|
|
17
19
|
}
|
|
18
|
-
if (type === 'infinite' && input &&
|
|
19
|
-
const { cursor: _ , ...
|
|
20
|
+
if (type === 'infinite' && isObject(input) && ('direction' in input || 'cursor' in input)) {
|
|
21
|
+
const { cursor: _ , direction: __ , ...inputWithoutCursorAndDirection } = input;
|
|
20
22
|
return [
|
|
21
23
|
splitPath,
|
|
22
24
|
{
|
|
23
|
-
input:
|
|
25
|
+
input: inputWithoutCursorAndDirection,
|
|
24
26
|
type: 'infinite'
|
|
25
27
|
}
|
|
26
28
|
];
|
package/dist/server/ssgProxy.js
CHANGED
|
@@ -23,7 +23,7 @@ var queryClient = require('../shared/queryClient.js');
|
|
|
23
23
|
serialize: transformer.output.serialize,
|
|
24
24
|
query: (queryOpts)=>{
|
|
25
25
|
return unstableCoreDoNotImport.callProcedure({
|
|
26
|
-
|
|
26
|
+
_def: router._def,
|
|
27
27
|
path: queryOpts.path,
|
|
28
28
|
getRawInput: async ()=>queryOpts.input,
|
|
29
29
|
ctx,
|
package/dist/server/ssgProxy.mjs
CHANGED
|
@@ -21,7 +21,7 @@ import { getQueryClient } from '../shared/queryClient.mjs';
|
|
|
21
21
|
serialize: transformer.output.serialize,
|
|
22
22
|
query: (queryOpts)=>{
|
|
23
23
|
return callProcedure({
|
|
24
|
-
|
|
24
|
+
_def: router._def,
|
|
25
25
|
path: queryOpts.path,
|
|
26
26
|
getRawInput: async ()=>queryOpts.input,
|
|
27
27
|
ctx,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createHooksInternal.d.ts","sourceRoot":"","sources":["../../../src/shared/hooks/createHooksInternal.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAExD,OAAO,KAAK,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AAsB,EACtB,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,EAClB,0BAA0B,EAC1B,mCAAmC,EACnC,kCAAkC,EAClC,2BAA2B,EAC3B,0BAA0B,EAC3B,MAAM,SAAS,CAAC;AAEjB;;GAEG;AACH,wBAAgB,eAAe,CAC7B,OAAO,SAAS,SAAS,EACzB,WAAW,GAAG,OAAO,EACrB,MAAM,CAAC,EAAE,sBAAsB,CAAC,OAAO,CAAC;;;;;qBAmFhC,MAAM,EAAE,SACP,OAAO;6BAwDR,MAAM,EAAE,SACP,OAAO;;;wBAsCR,MAAM,EAAE;4BAuCR,MAAM,EAAE,SACP,OAAO;6BA6CR,MAAM,EAAE,SACP,OAAO;qCAmER,MAAM,EAAE,SACP,OAAO;EAsHjB;AAED;;;GAGG;AACH,MAAM,MAAM,qBAAqB,CAC/B,OAAO,SAAS,SAAS,EACzB,WAAW,GAAG,OAAO,IACnB,UAAU,CAAC,OAAO,eAAe,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC"}
|
|
@@ -255,7 +255,10 @@ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
|
255
255
|
} : {}
|
|
256
256
|
}
|
|
257
257
|
};
|
|
258
|
-
return client.query(...getClientArgs.getClientArgs(queryKey, actualOpts,
|
|
258
|
+
return client.query(...getClientArgs.getClientArgs(queryKey, actualOpts, {
|
|
259
|
+
pageParam: queryFunctionContext.pageParam ?? opts.initialCursor,
|
|
260
|
+
direction: queryFunctionContext.direction
|
|
261
|
+
}));
|
|
259
262
|
}
|
|
260
263
|
}, queryClient);
|
|
261
264
|
hook.trpc = useHookResult.useHookResult({
|
|
@@ -287,7 +290,10 @@ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
|
287
290
|
} : {}
|
|
288
291
|
}
|
|
289
292
|
};
|
|
290
|
-
return context.client.query(...getClientArgs.getClientArgs(queryKey, actualOpts,
|
|
293
|
+
return context.client.query(...getClientArgs.getClientArgs(queryKey, actualOpts, {
|
|
294
|
+
pageParam: queryFunctionContext.pageParam ?? opts.initialCursor,
|
|
295
|
+
direction: queryFunctionContext.direction
|
|
296
|
+
}));
|
|
291
297
|
}
|
|
292
298
|
}, context.queryClient);
|
|
293
299
|
hook.trpc = useHookResult.useHookResult({
|
|
@@ -234,7 +234,10 @@ import { createUseQueries } from '../proxy/useQueriesProxy.mjs';
|
|
|
234
234
|
} : {}
|
|
235
235
|
}
|
|
236
236
|
};
|
|
237
|
-
return client.query(...getClientArgs(queryKey, actualOpts,
|
|
237
|
+
return client.query(...getClientArgs(queryKey, actualOpts, {
|
|
238
|
+
pageParam: queryFunctionContext.pageParam ?? opts.initialCursor,
|
|
239
|
+
direction: queryFunctionContext.direction
|
|
240
|
+
}));
|
|
238
241
|
}
|
|
239
242
|
}, queryClient);
|
|
240
243
|
hook.trpc = useHookResult({
|
|
@@ -266,7 +269,10 @@ import { createUseQueries } from '../proxy/useQueriesProxy.mjs';
|
|
|
266
269
|
} : {}
|
|
267
270
|
}
|
|
268
271
|
};
|
|
269
|
-
return context.client.query(...getClientArgs(queryKey, actualOpts,
|
|
272
|
+
return context.client.query(...getClientArgs(queryKey, actualOpts, {
|
|
273
|
+
pageParam: queryFunctionContext.pageParam ?? opts.initialCursor,
|
|
274
|
+
direction: queryFunctionContext.direction
|
|
275
|
+
}));
|
|
270
276
|
}
|
|
271
277
|
}, context.queryClient);
|
|
272
278
|
hook.trpc = useHookResult({
|
|
@@ -4,7 +4,7 @@ import type { QueryLike } from './queryLike';
|
|
|
4
4
|
/**
|
|
5
5
|
* Use to describe a route path which matches a given route's interface
|
|
6
6
|
*/
|
|
7
|
-
export type RouterLike<TRouter extends AnyRouter> = RouterLikeInner<TRouter['_def']['_config']['$types'], TRouter['_def']['
|
|
7
|
+
export type RouterLike<TRouter extends AnyRouter> = RouterLikeInner<TRouter['_def']['_config']['$types'], TRouter['_def']['record']>;
|
|
8
8
|
export type RouterLikeInner<TRoot extends AnyRootTypes, TRecord extends RouterRecord> = {
|
|
9
9
|
[TKey in keyof TRecord]: TRecord[TKey] extends infer $Value ? $Value extends RouterRecord ? RouterLikeInner<TRoot, $Value> : $Value extends AnyQueryProcedure ? QueryLike<TRoot, $Value> : $Value extends AnyMutationProcedure ? MutationLike<TRoot, $Value> : never : never;
|
|
10
10
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routerLike.d.ts","sourceRoot":"","sources":["../../../src/shared/polymorphism/routerLike.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,iBAAiB,EACjB,YAAY,EACZ,SAAS,EACT,YAAY,EACb,MAAM,0CAA0C,CAAC;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C;;GAEG;AACH,MAAM,MAAM,UAAU,CAAC,OAAO,SAAS,SAAS,IAAI,eAAe,CACjE,OAAO,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,EACpC,OAAO,CAAC,MAAM,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"routerLike.d.ts","sourceRoot":"","sources":["../../../src/shared/polymorphism/routerLike.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,iBAAiB,EACjB,YAAY,EACZ,SAAS,EACT,YAAY,EACb,MAAM,0CAA0C,CAAC;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C;;GAEG;AACH,MAAM,MAAM,UAAU,CAAC,OAAO,SAAS,SAAS,IAAI,eAAe,CACjE,OAAO,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,EACpC,OAAO,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAC1B,CAAC;AACF,MAAM,MAAM,eAAe,CACzB,KAAK,SAAS,YAAY,EAC1B,OAAO,SAAS,YAAY,IAC1B;KACD,IAAI,IAAI,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,SAAS,MAAM,MAAM,GACvD,MAAM,SAAS,YAAY,GACzB,eAAe,CAAC,KAAK,EAAE,MAAM,CAAC,GAC9B,MAAM,SAAS,iBAAiB,GAChC,SAAS,CAAC,KAAK,EAAE,MAAM,CAAC,GACxB,MAAM,SAAS,oBAAoB,GACnC,YAAY,CAAC,KAAK,EAAE,MAAM,CAAC,GAC3B,KAAK,GACP,KAAK;CACV,CAAC"}
|
|
@@ -23,8 +23,11 @@ var getClientArgs = require('../internals/getClientArgs.js');
|
|
|
23
23
|
return queryClient.fetchInfiniteQuery({
|
|
24
24
|
...opts,
|
|
25
25
|
queryKey,
|
|
26
|
-
queryFn: ({ pageParam })=>{
|
|
27
|
-
return untypedClient.query(...getClientArgs.getClientArgs(queryKey, opts,
|
|
26
|
+
queryFn: ({ pageParam , direction })=>{
|
|
27
|
+
return untypedClient.query(...getClientArgs.getClientArgs(queryKey, opts, {
|
|
28
|
+
pageParam,
|
|
29
|
+
direction
|
|
30
|
+
}));
|
|
28
31
|
},
|
|
29
32
|
initialPageParam: opts?.initialCursor ?? null
|
|
30
33
|
});
|
|
@@ -40,8 +43,11 @@ var getClientArgs = require('../internals/getClientArgs.js');
|
|
|
40
43
|
return queryClient.prefetchInfiniteQuery({
|
|
41
44
|
...opts,
|
|
42
45
|
queryKey,
|
|
43
|
-
queryFn: ({ pageParam })=>{
|
|
44
|
-
return untypedClient.query(...getClientArgs.getClientArgs(queryKey, opts,
|
|
46
|
+
queryFn: ({ pageParam , direction })=>{
|
|
47
|
+
return untypedClient.query(...getClientArgs.getClientArgs(queryKey, opts, {
|
|
48
|
+
pageParam,
|
|
49
|
+
direction
|
|
50
|
+
}));
|
|
45
51
|
},
|
|
46
52
|
initialPageParam: opts?.initialCursor ?? null
|
|
47
53
|
});
|
|
@@ -21,8 +21,11 @@ import { getClientArgs } from '../internals/getClientArgs.mjs';
|
|
|
21
21
|
return queryClient.fetchInfiniteQuery({
|
|
22
22
|
...opts,
|
|
23
23
|
queryKey,
|
|
24
|
-
queryFn: ({ pageParam })=>{
|
|
25
|
-
return untypedClient.query(...getClientArgs(queryKey, opts,
|
|
24
|
+
queryFn: ({ pageParam , direction })=>{
|
|
25
|
+
return untypedClient.query(...getClientArgs(queryKey, opts, {
|
|
26
|
+
pageParam,
|
|
27
|
+
direction
|
|
28
|
+
}));
|
|
26
29
|
},
|
|
27
30
|
initialPageParam: opts?.initialCursor ?? null
|
|
28
31
|
});
|
|
@@ -38,8 +41,11 @@ import { getClientArgs } from '../internals/getClientArgs.mjs';
|
|
|
38
41
|
return queryClient.prefetchInfiniteQuery({
|
|
39
42
|
...opts,
|
|
40
43
|
queryKey,
|
|
41
|
-
queryFn: ({ pageParam })=>{
|
|
42
|
-
return untypedClient.query(...getClientArgs(queryKey, opts,
|
|
44
|
+
queryFn: ({ pageParam , direction })=>{
|
|
45
|
+
return untypedClient.query(...getClientArgs(queryKey, opts, {
|
|
46
|
+
pageParam,
|
|
47
|
+
direction
|
|
48
|
+
}));
|
|
43
49
|
},
|
|
44
50
|
initialPageParam: opts?.initialCursor ?? null
|
|
45
51
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trpc/react-query",
|
|
3
|
-
"version": "11.0.0-alpha-tmp-
|
|
3
|
+
"version": "11.0.0-alpha-tmp-issues-4129-lazy-routers.302+4e59b6862",
|
|
4
4
|
"description": "The tRPC React library",
|
|
5
5
|
"author": "KATT",
|
|
6
6
|
"license": "MIT",
|
|
@@ -58,15 +58,15 @@
|
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
60
|
"@tanstack/react-query": "^5.0.0",
|
|
61
|
-
"@trpc/client": "11.0.0-alpha-tmp-
|
|
62
|
-
"@trpc/server": "11.0.0-alpha-tmp-
|
|
61
|
+
"@trpc/client": "11.0.0-alpha-tmp-issues-4129-lazy-routers.302+4e59b6862",
|
|
62
|
+
"@trpc/server": "11.0.0-alpha-tmp-issues-4129-lazy-routers.302+4e59b6862",
|
|
63
63
|
"react": ">=18.2.0",
|
|
64
64
|
"react-dom": ">=18.2.0"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@tanstack/react-query": "^5.0.0",
|
|
68
|
-
"@trpc/client": "11.0.0-alpha-tmp-
|
|
69
|
-
"@trpc/server": "11.0.0-alpha-tmp-
|
|
68
|
+
"@trpc/client": "11.0.0-alpha-tmp-issues-4129-lazy-routers.302+4e59b6862",
|
|
69
|
+
"@trpc/server": "11.0.0-alpha-tmp-issues-4129-lazy-routers.302+4e59b6862",
|
|
70
70
|
"@types/express": "^4.17.17",
|
|
71
71
|
"@types/node": "^20.10.0",
|
|
72
72
|
"@types/react": "^18.2.33",
|
|
@@ -85,5 +85,5 @@
|
|
|
85
85
|
"funding": [
|
|
86
86
|
"https://trpc.io/sponsor"
|
|
87
87
|
],
|
|
88
|
-
"gitHead": "
|
|
88
|
+
"gitHead": "4e59b6862d297264bf990cf53ff09a5cabd8e4e7"
|
|
89
89
|
}
|
package/src/createTRPCReact.tsx
CHANGED
|
@@ -85,6 +85,7 @@ type CursorInput = {
|
|
|
85
85
|
cursor?: any;
|
|
86
86
|
} | void;
|
|
87
87
|
|
|
88
|
+
type ReservedInfiniteQueryKeys = 'cursor' | 'direction';
|
|
88
89
|
/**
|
|
89
90
|
* @internal
|
|
90
91
|
*/
|
|
@@ -95,7 +96,7 @@ export type MaybeDecoratedInfiniteQuery<TDef extends ResolverDef> =
|
|
|
95
96
|
* @link https://trpc.io/docs/v11/client/react/suspense#useinfinitesuspensequery
|
|
96
97
|
*/
|
|
97
98
|
useInfiniteQuery: (
|
|
98
|
-
input: Omit<TDef['input'],
|
|
99
|
+
input: Omit<TDef['input'], ReservedInfiniteQueryKeys>,
|
|
99
100
|
opts: UseTRPCInfiniteQueryOptions<
|
|
100
101
|
TDef['input'],
|
|
101
102
|
TDef['output'],
|
|
@@ -110,7 +111,7 @@ export type MaybeDecoratedInfiniteQuery<TDef extends ResolverDef> =
|
|
|
110
111
|
* @link https://trpc.io/docs/v11/client/react/suspense
|
|
111
112
|
*/
|
|
112
113
|
useSuspenseInfiniteQuery: (
|
|
113
|
-
input: Omit<TDef['input'], 'cursor'>,
|
|
114
|
+
input: Omit<TDef['input'], 'cursor' | 'direction'>,
|
|
114
115
|
opts: UseTRPCSuspenseInfiniteQueryOptions<
|
|
115
116
|
TDef['input'],
|
|
116
117
|
TDef['output'],
|
|
@@ -6,14 +6,18 @@ import type { TRPCQueryKey } from './getQueryKey';
|
|
|
6
6
|
export function getClientArgs<TOptions>(
|
|
7
7
|
queryKey: TRPCQueryKey,
|
|
8
8
|
opts: TOptions,
|
|
9
|
-
|
|
9
|
+
infiniteParams?: {
|
|
10
|
+
pageParam: any;
|
|
11
|
+
direction: 'forward' | 'backward';
|
|
12
|
+
},
|
|
10
13
|
) {
|
|
11
14
|
const path = queryKey[0];
|
|
12
15
|
let input = queryKey[1]?.input;
|
|
13
|
-
if (
|
|
16
|
+
if (infiniteParams) {
|
|
14
17
|
input = {
|
|
15
18
|
...(input ?? {}),
|
|
16
|
-
cursor: pageParam,
|
|
19
|
+
...(infiniteParams.pageParam ? { cursor: infiniteParams.pageParam } : {}),
|
|
20
|
+
direction: infiniteParams.direction,
|
|
17
21
|
};
|
|
18
22
|
}
|
|
19
23
|
return [path.join('.'), input, (opts as any)?.trpc] as const;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
|
+
isObject,
|
|
3
|
+
type DeepPartial,
|
|
4
|
+
} from '@trpc/server/unstable-core-do-not-import';
|
|
2
5
|
import type { DecoratedMutation, DecoratedQuery } from '../createTRPCReact';
|
|
3
6
|
import type { DecorateRouterRecord } from '../shared';
|
|
4
7
|
|
|
@@ -39,16 +42,18 @@ export function getQueryKeyInternal(
|
|
|
39
42
|
|
|
40
43
|
if (
|
|
41
44
|
type === 'infinite' &&
|
|
42
|
-
input &&
|
|
43
|
-
|
|
44
|
-
'cursor' in input
|
|
45
|
+
isObject(input) &&
|
|
46
|
+
('direction' in input || 'cursor' in input)
|
|
45
47
|
) {
|
|
46
|
-
const {
|
|
47
|
-
|
|
48
|
+
const {
|
|
49
|
+
cursor: _,
|
|
50
|
+
direction: __,
|
|
51
|
+
...inputWithoutCursorAndDirection
|
|
52
|
+
} = input;
|
|
48
53
|
return [
|
|
49
54
|
splitPath,
|
|
50
55
|
{
|
|
51
|
-
input:
|
|
56
|
+
input: inputWithoutCursorAndDirection,
|
|
52
57
|
type: 'infinite',
|
|
53
58
|
},
|
|
54
59
|
];
|
|
@@ -64,10 +69,13 @@ export function getQueryKeyInternal(
|
|
|
64
69
|
|
|
65
70
|
type GetInfiniteQueryInput<
|
|
66
71
|
TProcedureInput,
|
|
67
|
-
|
|
68
|
-
|
|
72
|
+
TInputWithoutCursorAndDirection = Omit<
|
|
73
|
+
TProcedureInput,
|
|
74
|
+
'cursor' | 'direction'
|
|
75
|
+
>,
|
|
76
|
+
> = keyof TInputWithoutCursorAndDirection extends never
|
|
69
77
|
? undefined
|
|
70
|
-
: DeepPartial<
|
|
78
|
+
: DeepPartial<TInputWithoutCursorAndDirection> | undefined;
|
|
71
79
|
|
|
72
80
|
/** @internal */
|
|
73
81
|
export type GetQueryProcedureInput<TProcedureInput> = TProcedureInput extends {
|
package/src/server/ssgProxy.ts
CHANGED
|
@@ -149,7 +149,7 @@ export function createServerSideHelpers<TRouter extends AnyRouter>(
|
|
|
149
149
|
serialize: transformer.output.serialize,
|
|
150
150
|
query: (queryOpts) => {
|
|
151
151
|
return callProcedure({
|
|
152
|
-
|
|
152
|
+
_def: router._def,
|
|
153
153
|
path: queryOpts.path,
|
|
154
154
|
getRawInput: async () => queryOpts.input,
|
|
155
155
|
ctx,
|
|
@@ -364,11 +364,10 @@ export function createRootHooks<
|
|
|
364
364
|
};
|
|
365
365
|
|
|
366
366
|
return client.query(
|
|
367
|
-
...getClientArgs(
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
),
|
|
367
|
+
...getClientArgs(queryKey, actualOpts, {
|
|
368
|
+
pageParam: queryFunctionContext.pageParam ?? opts.initialCursor,
|
|
369
|
+
direction: queryFunctionContext.direction,
|
|
370
|
+
}),
|
|
372
371
|
);
|
|
373
372
|
},
|
|
374
373
|
},
|
|
@@ -417,11 +416,10 @@ export function createRootHooks<
|
|
|
417
416
|
};
|
|
418
417
|
|
|
419
418
|
return context.client.query(
|
|
420
|
-
...getClientArgs(
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
),
|
|
419
|
+
...getClientArgs(queryKey, actualOpts, {
|
|
420
|
+
pageParam: queryFunctionContext.pageParam ?? opts.initialCursor,
|
|
421
|
+
direction: queryFunctionContext.direction,
|
|
422
|
+
}),
|
|
425
423
|
);
|
|
426
424
|
},
|
|
427
425
|
},
|
|
@@ -13,7 +13,7 @@ import type { QueryLike } from './queryLike';
|
|
|
13
13
|
*/
|
|
14
14
|
export type RouterLike<TRouter extends AnyRouter> = RouterLikeInner<
|
|
15
15
|
TRouter['_def']['_config']['$types'],
|
|
16
|
-
TRouter['_def']['
|
|
16
|
+
TRouter['_def']['record']
|
|
17
17
|
>;
|
|
18
18
|
export type RouterLikeInner<
|
|
19
19
|
TRoot extends AnyRootTypes,
|
|
@@ -42,9 +42,9 @@ export function createUtilityFunctions<TRouter extends AnyRouter>(
|
|
|
42
42
|
return queryClient.fetchInfiniteQuery({
|
|
43
43
|
...opts,
|
|
44
44
|
queryKey,
|
|
45
|
-
queryFn: ({ pageParam }) => {
|
|
45
|
+
queryFn: ({ pageParam, direction }) => {
|
|
46
46
|
return untypedClient.query(
|
|
47
|
-
...getClientArgs(queryKey, opts, pageParam),
|
|
47
|
+
...getClientArgs(queryKey, opts, { pageParam, direction }),
|
|
48
48
|
);
|
|
49
49
|
},
|
|
50
50
|
initialPageParam: opts?.initialCursor ?? null,
|
|
@@ -63,9 +63,9 @@ export function createUtilityFunctions<TRouter extends AnyRouter>(
|
|
|
63
63
|
return queryClient.prefetchInfiniteQuery({
|
|
64
64
|
...opts,
|
|
65
65
|
queryKey,
|
|
66
|
-
queryFn: ({ pageParam }) => {
|
|
66
|
+
queryFn: ({ pageParam, direction }) => {
|
|
67
67
|
return untypedClient.query(
|
|
68
|
-
...getClientArgs(queryKey, opts, pageParam),
|
|
68
|
+
...getClientArgs(queryKey, opts, { pageParam, direction }),
|
|
69
69
|
);
|
|
70
70
|
},
|
|
71
71
|
initialPageParam: opts?.initialCursor ?? null,
|