@trpc/react-query 11.0.0-next-beta.255 → 11.0.0-next-beta.260
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 +19 -19
- package/dist/internals/useHookResult.d.ts +4 -6
- package/dist/internals/useHookResult.d.ts.map +1 -1
- package/dist/internals/useHookResult.js +6 -3
- package/dist/internals/useHookResult.mjs +6 -3
- package/dist/shared/hooks/createHooksInternal.js +5 -5
- package/dist/shared/hooks/createHooksInternal.mjs +5 -5
- package/dist/shared/hooks/types.d.ts +5 -1
- package/dist/shared/hooks/types.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/internals/useHookResult.ts +11 -12
- package/src/shared/hooks/createHooksInternal.tsx +5 -5
- package/src/shared/hooks/types.ts +6 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
-
"bundleSize":
|
|
3
|
-
"bundleOrigSize":
|
|
4
|
-
"bundleReduction": 56.
|
|
2
|
+
"bundleSize": 27242,
|
|
3
|
+
"bundleOrigSize": 61974,
|
|
4
|
+
"bundleReduction": 56.04,
|
|
5
5
|
"modules": [
|
|
6
6
|
{
|
|
7
7
|
"id": "/src/shared/hooks/createHooksInternal.tsx",
|
|
8
|
-
"size":
|
|
9
|
-
"origSize":
|
|
8
|
+
"size": 12372,
|
|
9
|
+
"origSize": 14404,
|
|
10
10
|
"renderedExports": [
|
|
11
11
|
"createRootHooks"
|
|
12
12
|
],
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"dependents": [
|
|
15
15
|
"/src/createTRPCReact.tsx"
|
|
16
16
|
],
|
|
17
|
-
"percent": 45.
|
|
18
|
-
"reduction": 14.
|
|
17
|
+
"percent": 45.42,
|
|
18
|
+
"reduction": 14.11
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
21
|
"id": "/src/server/ssgProxy.ts",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"dependents": [
|
|
29
29
|
"/src/server/index.ts"
|
|
30
30
|
],
|
|
31
|
-
"percent": 13.
|
|
31
|
+
"percent": 13.48,
|
|
32
32
|
"reduction": 50.36
|
|
33
33
|
},
|
|
34
34
|
{
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"/src/createTRPCQueryUtils.tsx",
|
|
44
44
|
"/src/shared/hooks/createHooksInternal.tsx"
|
|
45
45
|
],
|
|
46
|
-
"percent": 12.
|
|
46
|
+
"percent": 12.24,
|
|
47
47
|
"reduction": 10.5
|
|
48
48
|
},
|
|
49
49
|
{
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"dependents": [
|
|
60
60
|
"/src/shared/index.ts"
|
|
61
61
|
],
|
|
62
|
-
"percent": 10.
|
|
62
|
+
"percent": 10.08,
|
|
63
63
|
"reduction": 73.94
|
|
64
64
|
},
|
|
65
65
|
{
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"/src/shared/proxy/useQueriesProxy.ts",
|
|
79
79
|
"/src/shared/hooks/createHooksInternal.tsx"
|
|
80
80
|
],
|
|
81
|
-
"percent": 6.
|
|
81
|
+
"percent": 6.95,
|
|
82
82
|
"reduction": 54.97
|
|
83
83
|
},
|
|
84
84
|
{
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
"dependents": [
|
|
94
94
|
"/src/index.ts"
|
|
95
95
|
],
|
|
96
|
-
"percent": 3.
|
|
96
|
+
"percent": 3.12,
|
|
97
97
|
"reduction": 90.09
|
|
98
98
|
},
|
|
99
99
|
{
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
"dependents": [
|
|
108
108
|
"/src/shared/index.ts"
|
|
109
109
|
],
|
|
110
|
-
"percent": 2.
|
|
110
|
+
"percent": 2.96,
|
|
111
111
|
"reduction": 23.16
|
|
112
112
|
},
|
|
113
113
|
{
|
|
@@ -122,7 +122,7 @@
|
|
|
122
122
|
"/src/shared/index.ts",
|
|
123
123
|
"/src/shared/hooks/createHooksInternal.tsx"
|
|
124
124
|
],
|
|
125
|
-
"percent": 2.
|
|
125
|
+
"percent": 2.09,
|
|
126
126
|
"reduction": 82.03
|
|
127
127
|
},
|
|
128
128
|
{
|
|
@@ -143,8 +143,8 @@
|
|
|
143
143
|
},
|
|
144
144
|
{
|
|
145
145
|
"id": "/src/internals/useHookResult.ts",
|
|
146
|
-
"size":
|
|
147
|
-
"origSize":
|
|
146
|
+
"size": 222,
|
|
147
|
+
"origSize": 348,
|
|
148
148
|
"renderedExports": [
|
|
149
149
|
"useHookResult"
|
|
150
150
|
],
|
|
@@ -152,8 +152,8 @@
|
|
|
152
152
|
"dependents": [
|
|
153
153
|
"/src/shared/hooks/createHooksInternal.tsx"
|
|
154
154
|
],
|
|
155
|
-
"percent": 0.
|
|
156
|
-
"reduction":
|
|
155
|
+
"percent": 0.81,
|
|
156
|
+
"reduction": 36.21
|
|
157
157
|
},
|
|
158
158
|
{
|
|
159
159
|
"id": "/src/createTRPCQueryUtils.tsx",
|
|
@@ -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.57,
|
|
188
188
|
"reduction": 97.47
|
|
189
189
|
},
|
|
190
190
|
{
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
trpc: {
|
|
3
|
-
path: string;
|
|
4
|
-
};
|
|
5
|
-
}
|
|
1
|
+
import type { TRPCHookResult } from '../shared/hooks/types';
|
|
6
2
|
/**
|
|
7
3
|
* Makes a stable reference of the `trpc` prop
|
|
8
4
|
*/
|
|
9
|
-
export declare function useHookResult(value:
|
|
5
|
+
export declare function useHookResult(value: {
|
|
6
|
+
path: string[];
|
|
7
|
+
}): TRPCHookResult['trpc'];
|
|
10
8
|
//# sourceMappingURL=useHookResult.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useHookResult.d.ts","sourceRoot":"","sources":["../../src/internals/useHookResult.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useHookResult.d.ts","sourceRoot":"","sources":["../../src/internals/useHookResult.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE;IACnC,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB,GAAG,cAAc,CAAC,MAAM,CAAC,CAQzB"}
|
|
@@ -24,9 +24,12 @@ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
|
24
24
|
/**
|
|
25
25
|
* Makes a stable reference of the `trpc` prop
|
|
26
26
|
*/ function useHookResult(value) {
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
const path = value.path.join('.');
|
|
28
|
+
return React__namespace.useMemo(()=>({
|
|
29
|
+
path
|
|
30
|
+
}), [
|
|
31
|
+
path
|
|
32
|
+
]);
|
|
30
33
|
}
|
|
31
34
|
|
|
32
35
|
exports.useHookResult = useHookResult;
|
|
@@ -3,9 +3,12 @@ import * as React from 'react';
|
|
|
3
3
|
/**
|
|
4
4
|
* Makes a stable reference of the `trpc` prop
|
|
5
5
|
*/ function useHookResult(value) {
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
const path = value.path.join('.');
|
|
7
|
+
return React.useMemo(()=>({
|
|
8
|
+
path
|
|
9
|
+
}), [
|
|
10
|
+
path
|
|
11
|
+
]);
|
|
9
12
|
}
|
|
10
13
|
|
|
11
14
|
export { useHookResult };
|
|
@@ -122,7 +122,7 @@ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
|
122
122
|
}
|
|
123
123
|
}, queryClient);
|
|
124
124
|
hook.trpc = useHookResult.useHookResult({
|
|
125
|
-
path
|
|
125
|
+
path
|
|
126
126
|
});
|
|
127
127
|
return hook;
|
|
128
128
|
}
|
|
@@ -145,7 +145,7 @@ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
|
145
145
|
}
|
|
146
146
|
}, context.queryClient);
|
|
147
147
|
hook.trpc = useHookResult.useHookResult({
|
|
148
|
-
path
|
|
148
|
+
path
|
|
149
149
|
});
|
|
150
150
|
return [
|
|
151
151
|
hook.data,
|
|
@@ -180,7 +180,7 @@ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
|
180
180
|
}
|
|
181
181
|
}, queryClient);
|
|
182
182
|
hook.trpc = useHookResult.useHookResult({
|
|
183
|
-
path
|
|
183
|
+
path
|
|
184
184
|
});
|
|
185
185
|
return hook;
|
|
186
186
|
}
|
|
@@ -259,7 +259,7 @@ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
|
259
259
|
}
|
|
260
260
|
}, queryClient);
|
|
261
261
|
hook.trpc = useHookResult.useHookResult({
|
|
262
|
-
path
|
|
262
|
+
path
|
|
263
263
|
});
|
|
264
264
|
return hook;
|
|
265
265
|
}
|
|
@@ -291,7 +291,7 @@ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
|
291
291
|
}
|
|
292
292
|
}, context.queryClient);
|
|
293
293
|
hook.trpc = useHookResult.useHookResult({
|
|
294
|
-
path
|
|
294
|
+
path
|
|
295
295
|
});
|
|
296
296
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
297
297
|
return [
|
|
@@ -101,7 +101,7 @@ import { createUseQueries } from '../proxy/useQueriesProxy.mjs';
|
|
|
101
101
|
}
|
|
102
102
|
}, queryClient);
|
|
103
103
|
hook.trpc = useHookResult({
|
|
104
|
-
path
|
|
104
|
+
path
|
|
105
105
|
});
|
|
106
106
|
return hook;
|
|
107
107
|
}
|
|
@@ -124,7 +124,7 @@ import { createUseQueries } from '../proxy/useQueriesProxy.mjs';
|
|
|
124
124
|
}
|
|
125
125
|
}, context.queryClient);
|
|
126
126
|
hook.trpc = useHookResult({
|
|
127
|
-
path
|
|
127
|
+
path
|
|
128
128
|
});
|
|
129
129
|
return [
|
|
130
130
|
hook.data,
|
|
@@ -159,7 +159,7 @@ import { createUseQueries } from '../proxy/useQueriesProxy.mjs';
|
|
|
159
159
|
}
|
|
160
160
|
}, queryClient);
|
|
161
161
|
hook.trpc = useHookResult({
|
|
162
|
-
path
|
|
162
|
+
path
|
|
163
163
|
});
|
|
164
164
|
return hook;
|
|
165
165
|
}
|
|
@@ -238,7 +238,7 @@ import { createUseQueries } from '../proxy/useQueriesProxy.mjs';
|
|
|
238
238
|
}
|
|
239
239
|
}, queryClient);
|
|
240
240
|
hook.trpc = useHookResult({
|
|
241
|
-
path
|
|
241
|
+
path
|
|
242
242
|
});
|
|
243
243
|
return hook;
|
|
244
244
|
}
|
|
@@ -270,7 +270,7 @@ import { createUseQueries } from '../proxy/useQueriesProxy.mjs';
|
|
|
270
270
|
}
|
|
271
271
|
}, context.queryClient);
|
|
272
272
|
hook.trpc = useHookResult({
|
|
273
|
-
path
|
|
273
|
+
path
|
|
274
274
|
});
|
|
275
275
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
276
276
|
return [
|
|
@@ -4,7 +4,6 @@ import type { AnyRouter, DistributiveOmit } from '@trpc/server/unstable-core-do-
|
|
|
4
4
|
import type { ReactNode } from 'react';
|
|
5
5
|
import type { TRPCContextProps } from '../../internals/context';
|
|
6
6
|
import type { TRPCQueryKey } from '../../internals/getQueryKey';
|
|
7
|
-
import type { TRPCHookResult } from '../../internals/useHookResult';
|
|
8
7
|
export type OutputWithCursor<TData, TCursor = any> = {
|
|
9
8
|
cursor: TCursor | null;
|
|
10
9
|
data: TData;
|
|
@@ -97,4 +96,9 @@ export type UseTRPCSuspenseInfiniteQueryResult<TData, TError, TInput> = [
|
|
|
97
96
|
* @internal
|
|
98
97
|
*/
|
|
99
98
|
export type UseTRPCMutationResult<TData, TError, TVariables, TContext> = TRPCHookResult & UseMutationResult<TData, TError, TVariables, TContext>;
|
|
99
|
+
export interface TRPCHookResult {
|
|
100
|
+
trpc: {
|
|
101
|
+
path: string;
|
|
102
|
+
};
|
|
103
|
+
}
|
|
100
104
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/shared/hooks/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,eAAe,EACf,YAAY,EACZ,kCAAkC,EAClC,mBAAmB,EACnB,0BAA0B,EAC1B,YAAY,EACZ,mBAAmB,EACnB,uBAAuB,EACvB,sBAAsB,EACtB,kBAAkB,EAClB,iBAAiB,EACjB,cAAc,EACd,+BAA+B,EAC/B,8BAA8B,EAC9B,uBAAuB,EACvB,sBAAsB,EACvB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EACV,uBAAuB,EACvB,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EACV,SAAS,EACT,gBAAgB,EACjB,MAAM,0CAA0C,CAAC;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/shared/hooks/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,eAAe,EACf,YAAY,EACZ,kCAAkC,EAClC,mBAAmB,EACnB,0BAA0B,EAC1B,YAAY,EACZ,mBAAmB,EACnB,uBAAuB,EACvB,sBAAsB,EACtB,kBAAkB,EAClB,iBAAiB,EACjB,cAAc,EACd,+BAA+B,EAC/B,8BAA8B,EAC9B,uBAAuB,EACvB,sBAAsB,EACvB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EACV,uBAAuB,EACvB,kBAAkB,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C;CACH"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trpc/react-query",
|
|
3
|
-
"version": "11.0.0-next-beta.
|
|
3
|
+
"version": "11.0.0-next-beta.260+90919c495",
|
|
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-next-beta.
|
|
62
|
-
"@trpc/server": "11.0.0-next-beta.
|
|
61
|
+
"@trpc/client": "11.0.0-next-beta.260+90919c495",
|
|
62
|
+
"@trpc/server": "11.0.0-next-beta.260+90919c495",
|
|
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-next-beta.
|
|
69
|
-
"@trpc/server": "11.0.0-next-beta.
|
|
68
|
+
"@trpc/client": "11.0.0-next-beta.260+90919c495",
|
|
69
|
+
"@trpc/server": "11.0.0-next-beta.260+90919c495",
|
|
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": "90919c4956fefef1062b19f02cc0068b234bb730"
|
|
89
89
|
}
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
export interface TRPCHookResult {
|
|
4
|
-
trpc: {
|
|
5
|
-
path: string;
|
|
6
|
-
};
|
|
7
|
-
}
|
|
2
|
+
import type { TRPCHookResult } from '../shared/hooks/types';
|
|
8
3
|
|
|
9
4
|
/**
|
|
10
5
|
* Makes a stable reference of the `trpc` prop
|
|
11
6
|
*/
|
|
12
|
-
export function useHookResult(
|
|
13
|
-
|
|
14
|
-
): TRPCHookResult['trpc'] {
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
7
|
+
export function useHookResult(value: {
|
|
8
|
+
path: string[];
|
|
9
|
+
}): TRPCHookResult['trpc'] {
|
|
10
|
+
const path = value.path.join('.');
|
|
11
|
+
return React.useMemo(
|
|
12
|
+
() => ({
|
|
13
|
+
path,
|
|
14
|
+
}),
|
|
15
|
+
[path],
|
|
16
|
+
);
|
|
18
17
|
}
|
|
@@ -182,7 +182,7 @@ export function createRootHooks<
|
|
|
182
182
|
) as UseTRPCQueryResult<unknown, TError>;
|
|
183
183
|
|
|
184
184
|
hook.trpc = useHookResult({
|
|
185
|
-
path
|
|
185
|
+
path,
|
|
186
186
|
});
|
|
187
187
|
|
|
188
188
|
return hook;
|
|
@@ -221,7 +221,7 @@ export function createRootHooks<
|
|
|
221
221
|
) as UseTRPCQueryResult<unknown, TError>;
|
|
222
222
|
|
|
223
223
|
hook.trpc = useHookResult({
|
|
224
|
-
path
|
|
224
|
+
path,
|
|
225
225
|
});
|
|
226
226
|
|
|
227
227
|
return [hook.data, hook as any];
|
|
@@ -259,7 +259,7 @@ export function createRootHooks<
|
|
|
259
259
|
) as UseTRPCMutationResult<unknown, TError, unknown, unknown>;
|
|
260
260
|
|
|
261
261
|
hook.trpc = useHookResult({
|
|
262
|
-
path
|
|
262
|
+
path,
|
|
263
263
|
});
|
|
264
264
|
|
|
265
265
|
return hook;
|
|
@@ -376,7 +376,7 @@ export function createRootHooks<
|
|
|
376
376
|
) as UseTRPCInfiniteQueryResult<unknown, TError, unknown>;
|
|
377
377
|
|
|
378
378
|
hook.trpc = useHookResult({
|
|
379
|
-
path
|
|
379
|
+
path,
|
|
380
380
|
});
|
|
381
381
|
return hook;
|
|
382
382
|
}
|
|
@@ -429,7 +429,7 @@ export function createRootHooks<
|
|
|
429
429
|
) as UseTRPCInfiniteQueryResult<unknown, TError, unknown>;
|
|
430
430
|
|
|
431
431
|
hook.trpc = useHookResult({
|
|
432
|
-
path
|
|
432
|
+
path,
|
|
433
433
|
});
|
|
434
434
|
|
|
435
435
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
@@ -29,7 +29,6 @@ import type {
|
|
|
29
29
|
import type { ReactNode } from 'react';
|
|
30
30
|
import type { TRPCContextProps } from '../../internals/context';
|
|
31
31
|
import type { TRPCQueryKey } from '../../internals/getQueryKey';
|
|
32
|
-
import type { TRPCHookResult } from '../../internals/useHookResult';
|
|
33
32
|
|
|
34
33
|
export type OutputWithCursor<TData, TCursor = any> = {
|
|
35
34
|
cursor: TCursor | null;
|
|
@@ -226,3 +225,9 @@ export type UseTRPCSuspenseInfiniteQueryResult<TData, TError, TInput> = [
|
|
|
226
225
|
*/
|
|
227
226
|
export type UseTRPCMutationResult<TData, TError, TVariables, TContext> =
|
|
228
227
|
TRPCHookResult & UseMutationResult<TData, TError, TVariables, TContext>;
|
|
228
|
+
|
|
229
|
+
export interface TRPCHookResult {
|
|
230
|
+
trpc: {
|
|
231
|
+
path: string;
|
|
232
|
+
};
|
|
233
|
+
}
|