@trpc/react-query 10.0.0-rc.6 → 10.0.0-rc.8
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/README.md +3 -3
- package/dist/{createHooksInternal-026e76a9.mjs → createHooksInternal-2bef4843.mjs} +33 -20
- package/dist/{createHooksInternal-62a3b7fb.js → createHooksInternal-d633d100.js} +33 -20
- package/dist/createTRPCReact.d.ts +19 -8
- package/dist/createTRPCReact.d.ts.map +1 -1
- package/dist/{getArrayQueryKey-5ab807a3.js → getArrayQueryKey-24927615.js} +13 -3
- package/dist/{getArrayQueryKey-e56d8d64.mjs → getArrayQueryKey-c6f6badf.mjs} +13 -3
- package/dist/index.js +2 -2
- package/dist/index.mjs +2 -2
- package/dist/internals/getArrayQueryKey.d.ts +5 -1
- package/dist/internals/getArrayQueryKey.d.ts.map +1 -1
- package/dist/interop.d.ts +2 -2
- package/dist/interop.d.ts.map +1 -1
- package/dist/shared/hooks/createHooksInternal.d.ts +9 -1
- package/dist/shared/hooks/createHooksInternal.d.ts.map +1 -1
- package/dist/shared/index.js +2 -2
- package/dist/shared/index.mjs +2 -2
- package/dist/shared/proxy/decorationProxy.d.ts.map +1 -1
- package/dist/ssg/index.js +5 -5
- package/dist/ssg/index.mjs +5 -5
- package/dist/ssg/ssg.d.ts.map +1 -1
- package/package.json +7 -7
- package/src/createTRPCReact.tsx +62 -7
- package/src/internals/getArrayQueryKey.test.ts +43 -8
- package/src/internals/getArrayQueryKey.ts +15 -3
- package/src/interop.ts +3 -2
- package/src/shared/hooks/createHooksInternal.tsx +42 -21
- package/src/shared/proxy/decorationProxy.ts +11 -0
- package/src/ssg/ssg.ts +26 -20
package/src/ssg/ssg.ts
CHANGED
|
@@ -44,15 +44,18 @@ export function createSSGHelpers<TRouter extends AnyRouter>(
|
|
|
44
44
|
>(
|
|
45
45
|
...pathAndInput: [path: TPath, ...args: inferHandlerInput<TProcedure>]
|
|
46
46
|
) => {
|
|
47
|
-
return queryClient.prefetchQuery(
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
47
|
+
return queryClient.prefetchQuery(
|
|
48
|
+
getArrayQueryKey(pathAndInput, 'query'),
|
|
49
|
+
() => {
|
|
50
|
+
return callProcedure({
|
|
51
|
+
procedures: router._def.procedures,
|
|
52
|
+
path: pathAndInput[0],
|
|
53
|
+
rawInput: pathAndInput[1],
|
|
54
|
+
ctx,
|
|
55
|
+
type: 'query',
|
|
56
|
+
});
|
|
57
|
+
},
|
|
58
|
+
);
|
|
56
59
|
};
|
|
57
60
|
|
|
58
61
|
const prefetchInfiniteQuery = async <
|
|
@@ -62,7 +65,7 @@ export function createSSGHelpers<TRouter extends AnyRouter>(
|
|
|
62
65
|
...pathAndInput: [path: TPath, ...args: inferHandlerInput<TProcedure>]
|
|
63
66
|
) => {
|
|
64
67
|
return queryClient.prefetchInfiniteQuery(
|
|
65
|
-
getArrayQueryKey(pathAndInput),
|
|
68
|
+
getArrayQueryKey(pathAndInput, 'infinite'),
|
|
66
69
|
() => {
|
|
67
70
|
return callProcedure({
|
|
68
71
|
procedures: router._def.procedures,
|
|
@@ -82,15 +85,18 @@ export function createSSGHelpers<TRouter extends AnyRouter>(
|
|
|
82
85
|
>(
|
|
83
86
|
...pathAndInput: [path: TPath, ...args: inferHandlerInput<TProcedure>]
|
|
84
87
|
): Promise<TOutput> => {
|
|
85
|
-
return queryClient.fetchQuery(
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
88
|
+
return queryClient.fetchQuery(
|
|
89
|
+
getArrayQueryKey(pathAndInput, 'query'),
|
|
90
|
+
() => {
|
|
91
|
+
return callProcedure({
|
|
92
|
+
procedures: router._def.procedures,
|
|
93
|
+
path: pathAndInput[0],
|
|
94
|
+
rawInput: pathAndInput[1],
|
|
95
|
+
ctx,
|
|
96
|
+
type: 'query',
|
|
97
|
+
});
|
|
98
|
+
},
|
|
99
|
+
);
|
|
94
100
|
};
|
|
95
101
|
|
|
96
102
|
const fetchInfiniteQuery = async <
|
|
@@ -101,7 +107,7 @@ export function createSSGHelpers<TRouter extends AnyRouter>(
|
|
|
101
107
|
...pathAndInput: [path: TPath, ...args: inferHandlerInput<TProcedure>]
|
|
102
108
|
): Promise<InfiniteData<TOutput>> => {
|
|
103
109
|
return queryClient.fetchInfiniteQuery(
|
|
104
|
-
getArrayQueryKey(pathAndInput),
|
|
110
|
+
getArrayQueryKey(pathAndInput, 'infinite'),
|
|
105
111
|
() => {
|
|
106
112
|
return callProcedure({
|
|
107
113
|
procedures: router._def.procedures,
|