@trpc/react-query 11.0.0-next-beta.193 → 11.0.0-next-beta.204
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 +24 -24
- package/dist/{createHooksInternal-5cb13e16.js → createHooksInternal-4285c71a.js} +10 -10
- package/dist/{createHooksInternal-6c0232d7.js → createHooksInternal-5d2fa367.js} +29 -13
- package/dist/{createHooksInternal-df9ecb1f.mjs → createHooksInternal-e0b0564e.mjs} +10 -10
- package/dist/index.js +23 -3
- package/dist/index.mjs +5 -5
- package/dist/internals/context.d.ts +2 -2
- package/dist/internals/context.d.ts.map +1 -1
- package/dist/server/index.js +1 -1
- package/dist/server/index.mjs +1 -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/{utilsProxy-f0fe7c68.js → utilsProxy-0b88c1e3.js} +21 -1
- package/dist/{utilsProxy-5402e992.mjs → utilsProxy-61a4601f.mjs} +2 -2
- package/dist/{utilsProxy-c08ebe6e.js → utilsProxy-ff357a62.js} +2 -2
- package/package.json +5 -5
- package/src/createTRPCReact.tsx +2 -2
- package/src/internals/context.tsx +2 -2
- package/src/internals/useHookResult.ts +2 -2
- package/src/shared/hooks/createHooksInternal.tsx +10 -8
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
-
"bundleSize":
|
|
3
|
-
"bundleOrigSize":
|
|
4
|
-
"bundleReduction": 56.
|
|
2
|
+
"bundleSize": 26832,
|
|
3
|
+
"bundleOrigSize": 62202,
|
|
4
|
+
"bundleReduction": 56.86,
|
|
5
5
|
"modules": [
|
|
6
6
|
{
|
|
7
7
|
"id": "/src/shared/hooks/createHooksInternal.tsx",
|
|
8
|
-
"size":
|
|
9
|
-
"origSize":
|
|
8
|
+
"size": 12646,
|
|
9
|
+
"origSize": 15390,
|
|
10
10
|
"renderedExports": [
|
|
11
11
|
"createRootHooks"
|
|
12
12
|
],
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"dependents": [
|
|
15
15
|
"/src/createTRPCReact.tsx"
|
|
16
16
|
],
|
|
17
|
-
"percent": 47.
|
|
18
|
-
"reduction":
|
|
17
|
+
"percent": 47.13,
|
|
18
|
+
"reduction": 17.83
|
|
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.55,
|
|
32
32
|
"reduction": 48.9
|
|
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.16,
|
|
47
47
|
"reduction": 11.66
|
|
48
48
|
},
|
|
49
49
|
{
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"dependents": [
|
|
60
60
|
"/src/shared/index.ts"
|
|
61
61
|
],
|
|
62
|
-
"percent": 9.
|
|
62
|
+
"percent": 9.91,
|
|
63
63
|
"reduction": 74.5
|
|
64
64
|
},
|
|
65
65
|
{
|
|
@@ -78,13 +78,13 @@
|
|
|
78
78
|
"/src/shared/proxy/useQueriesProxy.ts",
|
|
79
79
|
"/src/shared/hooks/createHooksInternal.tsx"
|
|
80
80
|
],
|
|
81
|
-
"percent": 5.
|
|
81
|
+
"percent": 5.78,
|
|
82
82
|
"reduction": 60.39
|
|
83
83
|
},
|
|
84
84
|
{
|
|
85
85
|
"id": "/src/createTRPCReact.tsx",
|
|
86
|
-
"size":
|
|
87
|
-
"origSize":
|
|
86
|
+
"size": 837,
|
|
87
|
+
"origSize": 8737,
|
|
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": 90.
|
|
96
|
+
"percent": 3.12,
|
|
97
|
+
"reduction": 90.42
|
|
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.93,
|
|
111
111
|
"reduction": 20.42
|
|
112
112
|
},
|
|
113
113
|
{
|
|
@@ -143,8 +143,8 @@
|
|
|
143
143
|
},
|
|
144
144
|
{
|
|
145
145
|
"id": "/src/internals/useHookResult.ts",
|
|
146
|
-
"size":
|
|
147
|
-
"origSize":
|
|
146
|
+
"size": 195,
|
|
147
|
+
"origSize": 342,
|
|
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.73,
|
|
156
|
+
"reduction": 42.98
|
|
157
157
|
},
|
|
158
158
|
{
|
|
159
159
|
"id": "/src/createTRPCQueryUtils.tsx",
|
|
@@ -171,8 +171,8 @@
|
|
|
171
171
|
},
|
|
172
172
|
{
|
|
173
173
|
"id": "/src/internals/context.tsx",
|
|
174
|
-
"size":
|
|
175
|
-
"origSize":
|
|
174
|
+
"size": 154,
|
|
175
|
+
"origSize": 6071,
|
|
176
176
|
"renderedExports": [
|
|
177
177
|
"contextProps",
|
|
178
178
|
"TRPCContext"
|
|
@@ -184,8 +184,8 @@
|
|
|
184
184
|
"/src/shared/proxy/utilsProxy.ts",
|
|
185
185
|
"/src/shared/hooks/createHooksInternal.tsx"
|
|
186
186
|
],
|
|
187
|
-
"percent": 0.
|
|
188
|
-
"reduction": 97.
|
|
187
|
+
"percent": 0.57,
|
|
188
|
+
"reduction": 97.46
|
|
189
189
|
},
|
|
190
190
|
{
|
|
191
191
|
"id": "/src/shared/queryClient.ts",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createRecursiveProxy } from '@trpc/core';
|
|
2
2
|
import { useQuery, useSuspenseQuery, useQueryClient, useMutation, hashKey, useInfiniteQuery, useSuspenseInfiniteQuery, useQueries, useSuspenseQueries } from '@tanstack/react-query';
|
|
3
3
|
import { TRPCUntypedClient, getUntypedClient, createTRPCUntypedClient } from '@trpc/client';
|
|
4
|
-
import
|
|
5
|
-
import { b as getQueryKeyInternal, T as TRPCContext } from './utilsProxy-
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { b as getQueryKeyInternal, T as TRPCContext } from './utilsProxy-ff357a62.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Create proxy for decorating procedures
|
|
@@ -63,7 +63,7 @@ function getClientArgs(queryKey, opts, pageParam) {
|
|
|
63
63
|
* Makes a stable reference of the `trpc` prop
|
|
64
64
|
*/
|
|
65
65
|
function useHookResult(value) {
|
|
66
|
-
const ref = useRef(value);
|
|
66
|
+
const ref = React.useRef(value);
|
|
67
67
|
ref.current.path = value.path;
|
|
68
68
|
return ref.current;
|
|
69
69
|
}
|
|
@@ -170,12 +170,12 @@ function createRootHooks(config) {
|
|
|
170
170
|
};
|
|
171
171
|
const TRPCProvider = (props) => {
|
|
172
172
|
const { abortOnUnmount = false, client, queryClient, ssrContext } = props;
|
|
173
|
-
const [ssrState, setSSRState] = useState(props.ssrState ?? false);
|
|
174
|
-
const fns = useMemo(() => createUtilityFunctions({
|
|
173
|
+
const [ssrState, setSSRState] = React.useState(props.ssrState ?? false);
|
|
174
|
+
const fns = React.useMemo(() => createUtilityFunctions({
|
|
175
175
|
client,
|
|
176
176
|
queryClient,
|
|
177
177
|
}), [client, queryClient]);
|
|
178
|
-
const contextValue = useMemo(() => ({
|
|
178
|
+
const contextValue = React.useMemo(() => ({
|
|
179
179
|
abortOnUnmount,
|
|
180
180
|
queryClient,
|
|
181
181
|
client,
|
|
@@ -183,7 +183,7 @@ function createRootHooks(config) {
|
|
|
183
183
|
ssrState,
|
|
184
184
|
...fns,
|
|
185
185
|
}), [abortOnUnmount, client, fns, queryClient, ssrContext, ssrState]);
|
|
186
|
-
useEffect(() => {
|
|
186
|
+
React.useEffect(() => {
|
|
187
187
|
// Only updating state to `mounted` if we are using SSR.
|
|
188
188
|
// This makes it so we don't have an unnecessary re-render when opting out of SSR.
|
|
189
189
|
setSSRState((state) => (state ? 'mounted' : false));
|
|
@@ -305,9 +305,9 @@ function createRootHooks(config) {
|
|
|
305
305
|
const enabled = opts?.enabled ?? true;
|
|
306
306
|
const queryKey = hashKey(getQueryKeyInternal(path, input, 'any'));
|
|
307
307
|
const { client } = useContext();
|
|
308
|
-
const optsRef = useRef(opts);
|
|
308
|
+
const optsRef = React.useRef(opts);
|
|
309
309
|
optsRef.current = opts;
|
|
310
|
-
useEffect(() => {
|
|
310
|
+
React.useEffect(() => {
|
|
311
311
|
if (!enabled) {
|
|
312
312
|
return;
|
|
313
313
|
}
|
|
@@ -442,7 +442,7 @@ function createRootHooks(config) {
|
|
|
442
442
|
return [hook.map((h) => h.data), hook];
|
|
443
443
|
};
|
|
444
444
|
const useDehydratedState = (client, trpcState) => {
|
|
445
|
-
const transformed = useMemo(() => {
|
|
445
|
+
const transformed = React.useMemo(() => {
|
|
446
446
|
if (!trpcState) {
|
|
447
447
|
return trpcState;
|
|
448
448
|
}
|
|
@@ -4,11 +4,27 @@ var core = require('@trpc/core');
|
|
|
4
4
|
var reactQuery = require('@tanstack/react-query');
|
|
5
5
|
var client = require('@trpc/client');
|
|
6
6
|
var React = require('react');
|
|
7
|
-
var utilsProxy = require('./utilsProxy-
|
|
7
|
+
var utilsProxy = require('./utilsProxy-0b88c1e3.js');
|
|
8
8
|
|
|
9
|
-
function
|
|
9
|
+
function _interopNamespace(e) {
|
|
10
|
+
if (e && e.__esModule) return e;
|
|
11
|
+
var n = Object.create(null);
|
|
12
|
+
if (e) {
|
|
13
|
+
Object.keys(e).forEach(function (k) {
|
|
14
|
+
if (k !== 'default') {
|
|
15
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
16
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () { return e[k]; }
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
n["default"] = e;
|
|
24
|
+
return Object.freeze(n);
|
|
25
|
+
}
|
|
10
26
|
|
|
11
|
-
var
|
|
27
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
12
28
|
|
|
13
29
|
/**
|
|
14
30
|
* Create proxy for decorating procedures
|
|
@@ -71,7 +87,7 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
71
87
|
/**
|
|
72
88
|
* Makes a stable reference of the `trpc` prop
|
|
73
89
|
*/ function useHookResult(value) {
|
|
74
|
-
const ref =
|
|
90
|
+
const ref = React__namespace.useRef(value);
|
|
75
91
|
ref.current.path = value.path;
|
|
76
92
|
return ref.current;
|
|
77
93
|
}
|
|
@@ -174,15 +190,15 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
174
190
|
};
|
|
175
191
|
const TRPCProvider = (props)=>{
|
|
176
192
|
const { abortOnUnmount =false , client , queryClient , ssrContext } = props;
|
|
177
|
-
const [ssrState, setSSRState] =
|
|
178
|
-
const fns =
|
|
193
|
+
const [ssrState, setSSRState] = React__namespace.useState(props.ssrState ?? false);
|
|
194
|
+
const fns = React__namespace.useMemo(()=>createUtilityFunctions({
|
|
179
195
|
client,
|
|
180
196
|
queryClient
|
|
181
197
|
}), [
|
|
182
198
|
client,
|
|
183
199
|
queryClient
|
|
184
200
|
]);
|
|
185
|
-
const contextValue =
|
|
201
|
+
const contextValue = React__namespace.useMemo(()=>({
|
|
186
202
|
abortOnUnmount,
|
|
187
203
|
queryClient,
|
|
188
204
|
client,
|
|
@@ -197,17 +213,17 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
197
213
|
ssrContext,
|
|
198
214
|
ssrState
|
|
199
215
|
]);
|
|
200
|
-
|
|
216
|
+
React__namespace.useEffect(()=>{
|
|
201
217
|
// Only updating state to `mounted` if we are using SSR.
|
|
202
218
|
// This makes it so we don't have an unnecessary re-render when opting out of SSR.
|
|
203
219
|
setSSRState((state)=>state ? 'mounted' : false);
|
|
204
220
|
}, []);
|
|
205
|
-
return /*#__PURE__*/
|
|
221
|
+
return /*#__PURE__*/ React__namespace.createElement(Context.Provider, {
|
|
206
222
|
value: contextValue
|
|
207
223
|
}, props.children);
|
|
208
224
|
};
|
|
209
225
|
function useContext() {
|
|
210
|
-
const context =
|
|
226
|
+
const context = React__namespace.useContext(Context);
|
|
211
227
|
if (!context) {
|
|
212
228
|
throw new Error('Unable to find tRPC Context. Did you forget to wrap your App inside `withTRPC` HoC?');
|
|
213
229
|
}
|
|
@@ -323,9 +339,9 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
323
339
|
const enabled = opts?.enabled ?? true;
|
|
324
340
|
const queryKey = reactQuery.hashKey(utilsProxy.getQueryKeyInternal(path, input, 'any'));
|
|
325
341
|
const { client } = useContext();
|
|
326
|
-
const optsRef =
|
|
342
|
+
const optsRef = React__namespace.useRef(opts);
|
|
327
343
|
optsRef.current = opts;
|
|
328
|
-
|
|
344
|
+
React__namespace.useEffect(()=>{
|
|
329
345
|
if (!enabled) {
|
|
330
346
|
return;
|
|
331
347
|
}
|
|
@@ -471,7 +487,7 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
471
487
|
];
|
|
472
488
|
};
|
|
473
489
|
const useDehydratedState = (client, trpcState)=>{
|
|
474
|
-
const transformed =
|
|
490
|
+
const transformed = React__namespace.useMemo(()=>{
|
|
475
491
|
if (!trpcState) {
|
|
476
492
|
return trpcState;
|
|
477
493
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createRecursiveProxy } from '@trpc/core';
|
|
2
2
|
import { useQuery, useSuspenseQuery, useQueryClient, useMutation, hashKey, useInfiniteQuery, useSuspenseInfiniteQuery, useQueries, useSuspenseQueries } from '@tanstack/react-query';
|
|
3
3
|
import { TRPCUntypedClient, getUntypedClient, createTRPCUntypedClient } from '@trpc/client';
|
|
4
|
-
import
|
|
5
|
-
import { b as getQueryKeyInternal, T as TRPCContext } from './utilsProxy-
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { b as getQueryKeyInternal, T as TRPCContext } from './utilsProxy-61a4601f.mjs';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Create proxy for decorating procedures
|
|
@@ -65,7 +65,7 @@ import { b as getQueryKeyInternal, T as TRPCContext } from './utilsProxy-5402e99
|
|
|
65
65
|
/**
|
|
66
66
|
* Makes a stable reference of the `trpc` prop
|
|
67
67
|
*/ function useHookResult(value) {
|
|
68
|
-
const ref = useRef(value);
|
|
68
|
+
const ref = React.useRef(value);
|
|
69
69
|
ref.current.path = value.path;
|
|
70
70
|
return ref.current;
|
|
71
71
|
}
|
|
@@ -168,15 +168,15 @@ import { b as getQueryKeyInternal, T as TRPCContext } from './utilsProxy-5402e99
|
|
|
168
168
|
};
|
|
169
169
|
const TRPCProvider = (props)=>{
|
|
170
170
|
const { abortOnUnmount =false , client , queryClient , ssrContext } = props;
|
|
171
|
-
const [ssrState, setSSRState] = useState(props.ssrState ?? false);
|
|
172
|
-
const fns = useMemo(()=>createUtilityFunctions({
|
|
171
|
+
const [ssrState, setSSRState] = React.useState(props.ssrState ?? false);
|
|
172
|
+
const fns = React.useMemo(()=>createUtilityFunctions({
|
|
173
173
|
client,
|
|
174
174
|
queryClient
|
|
175
175
|
}), [
|
|
176
176
|
client,
|
|
177
177
|
queryClient
|
|
178
178
|
]);
|
|
179
|
-
const contextValue = useMemo(()=>({
|
|
179
|
+
const contextValue = React.useMemo(()=>({
|
|
180
180
|
abortOnUnmount,
|
|
181
181
|
queryClient,
|
|
182
182
|
client,
|
|
@@ -191,7 +191,7 @@ import { b as getQueryKeyInternal, T as TRPCContext } from './utilsProxy-5402e99
|
|
|
191
191
|
ssrContext,
|
|
192
192
|
ssrState
|
|
193
193
|
]);
|
|
194
|
-
useEffect(()=>{
|
|
194
|
+
React.useEffect(()=>{
|
|
195
195
|
// Only updating state to `mounted` if we are using SSR.
|
|
196
196
|
// This makes it so we don't have an unnecessary re-render when opting out of SSR.
|
|
197
197
|
setSSRState((state)=>state ? 'mounted' : false);
|
|
@@ -317,9 +317,9 @@ import { b as getQueryKeyInternal, T as TRPCContext } from './utilsProxy-5402e99
|
|
|
317
317
|
const enabled = opts?.enabled ?? true;
|
|
318
318
|
const queryKey = hashKey(getQueryKeyInternal(path, input, 'any'));
|
|
319
319
|
const { client } = useContext();
|
|
320
|
-
const optsRef = useRef(opts);
|
|
320
|
+
const optsRef = React.useRef(opts);
|
|
321
321
|
optsRef.current = opts;
|
|
322
|
-
useEffect(()=>{
|
|
322
|
+
React.useEffect(()=>{
|
|
323
323
|
if (!enabled) {
|
|
324
324
|
return;
|
|
325
325
|
}
|
|
@@ -465,7 +465,7 @@ import { b as getQueryKeyInternal, T as TRPCContext } from './utilsProxy-5402e99
|
|
|
465
465
|
];
|
|
466
466
|
};
|
|
467
467
|
const useDehydratedState = (client, trpcState)=>{
|
|
468
|
-
const transformed = useMemo(()=>{
|
|
468
|
+
const transformed = React.useMemo(()=>{
|
|
469
469
|
if (!trpcState) {
|
|
470
470
|
return trpcState;
|
|
471
471
|
}
|
package/dist/index.js
CHANGED
|
@@ -3,12 +3,32 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var client = require('@trpc/client');
|
|
6
|
-
var utilsProxy = require('./utilsProxy-
|
|
6
|
+
var utilsProxy = require('./utilsProxy-0b88c1e3.js');
|
|
7
7
|
var core = require('@trpc/core');
|
|
8
8
|
var React = require('react');
|
|
9
|
-
var createHooksInternal$1 = require('./createHooksInternal-
|
|
9
|
+
var createHooksInternal$1 = require('./createHooksInternal-5d2fa367.js');
|
|
10
10
|
require('@tanstack/react-query');
|
|
11
11
|
|
|
12
|
+
function _interopNamespace(e) {
|
|
13
|
+
if (e && e.__esModule) return 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
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
n["default"] = e;
|
|
27
|
+
return Object.freeze(n);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
31
|
+
|
|
12
32
|
/**
|
|
13
33
|
* @internal
|
|
14
34
|
*/ function createHooksInternal(trpc) {
|
|
@@ -17,7 +37,7 @@ require('@tanstack/react-query');
|
|
|
17
37
|
return ()=>{
|
|
18
38
|
const context = trpc.useUtils();
|
|
19
39
|
// create a stable reference of the utils context
|
|
20
|
-
return
|
|
40
|
+
return React__namespace.useMemo(()=>{
|
|
21
41
|
return utilsProxy.createReactQueryUtils(context);
|
|
22
42
|
}, [
|
|
23
43
|
context
|
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export * from '@trpc/client';
|
|
2
|
-
import { c as createReactQueryUtils, a as createQueryUtilsProxy } from './utilsProxy-
|
|
3
|
-
export { g as getQueryKey } from './utilsProxy-
|
|
2
|
+
import { c as createReactQueryUtils, a as createQueryUtilsProxy } from './utilsProxy-61a4601f.mjs';
|
|
3
|
+
export { g as getQueryKey } from './utilsProxy-61a4601f.mjs';
|
|
4
4
|
import { createFlatProxy } from '@trpc/core';
|
|
5
|
-
import
|
|
6
|
-
import { c as createRootHooks, a as createReactDecoration, b as createUtilityFunctions } from './createHooksInternal-
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
import { c as createRootHooks, a as createReactDecoration, b as createUtilityFunctions } from './createHooksInternal-e0b0564e.mjs';
|
|
7
7
|
import '@tanstack/react-query';
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -14,7 +14,7 @@ import '@tanstack/react-query';
|
|
|
14
14
|
return ()=>{
|
|
15
15
|
const context = trpc.useUtils();
|
|
16
16
|
// create a stable reference of the utils context
|
|
17
|
-
return useMemo(()=>{
|
|
17
|
+
return React.useMemo(()=>{
|
|
18
18
|
return createReactQueryUtils(context);
|
|
19
19
|
}, [
|
|
20
20
|
context
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import type { CancelOptions, FetchInfiniteQueryOptions, FetchQueryOptions, InfiniteData, InvalidateOptions, InvalidateQueryFilters, QueryClient, QueryFilters, RefetchOptions, RefetchQueryFilters, ResetOptions, SetDataOptions, Updater } from '@tanstack/react-query';
|
|
3
2
|
import type { CreateTRPCClient, TRPCClientError, TRPCRequestOptions, TRPCUntypedClient } from '@trpc/client';
|
|
4
3
|
import type { AnyRouter, DistributiveOmit } from '@trpc/core';
|
|
4
|
+
import * as React from 'react';
|
|
5
5
|
import type { ExtractCursorType } from '../shared';
|
|
6
6
|
import type { TRPCQueryKey } from './getQueryKey';
|
|
7
7
|
export type TRPCFetchQueryOptions<TOutput, TError> = DistributiveOmit<FetchQueryOptions<TOutput, TError>, 'queryKey'> & TRPCRequestOptions;
|
|
@@ -111,5 +111,5 @@ export interface TRPCQueryUtils<TRouter extends AnyRouter> {
|
|
|
111
111
|
*/
|
|
112
112
|
getInfiniteQueryData: (queryKey: TRPCQueryKey) => InfiniteData<unknown> | undefined;
|
|
113
113
|
}
|
|
114
|
-
export declare const TRPCContext:
|
|
114
|
+
export declare const TRPCContext: React.Context<any>;
|
|
115
115
|
//# sourceMappingURL=context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/internals/context.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/internals/context.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,yBAAyB,EACzB,iBAAiB,EACjB,YAAY,EACZ,iBAAiB,EACjB,sBAAsB,EACtB,WAAW,EACX,YAAY,EACZ,cAAc,EACd,mBAAmB,EACnB,YAAY,EACZ,cAAc,EACd,OAAO,EACR,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EACV,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAElD,MAAM,MAAM,qBAAqB,CAAC,OAAO,EAAE,MAAM,IAAI,gBAAgB,CACnE,iBAAiB,CAAC,OAAO,EAAE,MAAM,CAAC,EAClC,UAAU,CACX,GACC,kBAAkB,CAAC;AAErB,MAAM,MAAM,6BAA6B,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,IAC/D,gBAAgB,CACd,yBAAyB,CACvB,OAAO,EACP,MAAM,EACN,OAAO,EACP,YAAY,EACZ,iBAAiB,CAAC,MAAM,CAA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B;;OAEG;IACH,cAAc,EAAE,CACd,QAAQ,EAAE,YAAY,EACtB,OAAO,CAAC,EAAE,mBAAmB,EAC7B,OAAO,CAAC,EAAE,cAAc,KACrB,OAAO,CAAC,IAAI,CAAC,CAAC;IAEnB;;OAEG;IACH,WAAW,EAAE,CACX,QAAQ,EAAE,YAAY,EACtB,OAAO,CAAC,EAAE,aAAa,KACpB,OAAO,CAAC,IAAI,CAAC,CAAC;IAEnB;;OAEG;IACH,YAAY,EAAE,CACZ,QAAQ,EAAE,YAAY,EACtB,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,EAClC,OAAO,CAAC,EAAE,cAAc,KACrB,IAAI,CAAC;IAEV;;OAEG;IACH,YAAY,EAAE,CAAC,QAAQ,EAAE,YAAY,KAAK,OAAO,CAAC;IAClD;;OAEG;IACH,oBAAoB,EAAE,CACpB,QAAQ,EAAE,YAAY,EACtB,OAAO,EAAE,OAAO,CACd,YAAY,CAAC,OAAO,CAAC,GAAG,SAAS,EACjC,YAAY,CAAC,OAAO,CAAC,GAAG,SAAS,CAClC,EACD,OAAO,CAAC,EAAE,cAAc,KACrB,IAAI,CAAC;IAEV;;OAEG;IACH,oBAAoB,EAAE,CACpB,QAAQ,EAAE,YAAY,KACnB,YAAY,CAAC,OAAO,CAAC,GAAG,SAAS,CAAC;CACxC;AACD,eAAO,MAAM,WAAW,oBAAqC,CAAC"}
|
package/dist/server/index.js
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var reactQuery = require('@tanstack/react-query');
|
|
6
6
|
var client = require('@trpc/client');
|
|
7
7
|
var core = require('@trpc/core');
|
|
8
|
-
var utilsProxy = require('../utilsProxy-
|
|
8
|
+
var utilsProxy = require('../utilsProxy-0b88c1e3.js');
|
|
9
9
|
require('react');
|
|
10
10
|
var queryClient = require('../queryClient-358a9a75.js');
|
|
11
11
|
|
package/dist/server/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { dehydrate } from '@tanstack/react-query';
|
|
2
2
|
import { TRPCUntypedClient, getUntypedClient } from '@trpc/client';
|
|
3
3
|
import { callProcedure, createFlatProxy, createRecursiveProxy } from '@trpc/core';
|
|
4
|
-
import { b as getQueryKeyInternal, d as getQueryType } from '../utilsProxy-
|
|
4
|
+
import { b as getQueryKeyInternal, d as getQueryType } from '../utilsProxy-61a4601f.mjs';
|
|
5
5
|
import 'react';
|
|
6
6
|
import { g as getQueryClient } from '../queryClient-4d766c0c.mjs';
|
|
7
7
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createHooksInternal.d.ts","sourceRoot":"","sources":["../../../src/shared/hooks/createHooksInternal.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAExD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,OAAO,KAAK,EAAY,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAM1E,OAAO,KAAK,EACV,cAAc,EACd,sBAAsB,EACvB,MAAM,4BAA4B,CAAC;AAGpC,OAAO,KAAK,EAAE,sBAAsB,EAAuB,MAAM,UAAU,CAAC;AAC5E,OAAO,KAAK,EACV,YAAY,EACZ,YAAY,EAEZ,kBAAkB,EAClB,2BAA2B,EAC3B,0BAA0B,EAC1B,sBAAsB,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;;;;;
|
|
1
|
+
{"version":3,"file":"createHooksInternal.d.ts","sourceRoot":"","sources":["../../../src/shared/hooks/createHooksIn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OAAO,CACtE,OAAO,EACP,WAAW,CACZ,CAAC,IAAI,CAAC,CAAC;AAER;;;GAGG;AACH,MAAM,MAAM,qBAAqB,CAC/B,OAAO,SAAS,SAAS,EACzB,WAAW,GAAG,OAAO,IACnB,iBAAiB,CAAC,OAAO,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC"}
|
package/dist/shared/index.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var createHooksInternal = require('../createHooksInternal-
|
|
6
|
-
var utilsProxy = require('../utilsProxy-
|
|
5
|
+
var createHooksInternal = require('../createHooksInternal-5d2fa367.js');
|
|
6
|
+
var utilsProxy = require('../utilsProxy-0b88c1e3.js');
|
|
7
7
|
var queryClient = require('../queryClient-358a9a75.js');
|
|
8
8
|
require('@trpc/core');
|
|
9
9
|
require('@tanstack/react-query');
|
package/dist/shared/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { a as createReactDecoration, c as createRootHooks, d as createUseQueries, g as getClientArgs } from '../createHooksInternal-
|
|
2
|
-
export { T as TRPCContext, e as contextProps, a as createQueryUtilsProxy, c as createReactQueryUtils, d as getQueryType } from '../utilsProxy-
|
|
1
|
+
export { a as createReactDecoration, c as createRootHooks, d as createUseQueries, g as getClientArgs } from '../createHooksInternal-e0b0564e.mjs';
|
|
2
|
+
export { T as TRPCContext, e as contextProps, a as createQueryUtilsProxy, c as createReactQueryUtils, d as getQueryType } from '../utilsProxy-61a4601f.mjs';
|
|
3
3
|
export { g as getQueryClient } from '../queryClient-4d766c0c.mjs';
|
|
4
4
|
import '@trpc/core';
|
|
5
5
|
import '@tanstack/react-query';
|
|
@@ -4,6 +4,26 @@ var client = require('@trpc/client');
|
|
|
4
4
|
var core = require('@trpc/core');
|
|
5
5
|
var React = require('react');
|
|
6
6
|
|
|
7
|
+
function _interopNamespace(e) {
|
|
8
|
+
if (e && e.__esModule) return e;
|
|
9
|
+
var n = Object.create(null);
|
|
10
|
+
if (e) {
|
|
11
|
+
Object.keys(e).forEach(function (k) {
|
|
12
|
+
if (k !== 'default') {
|
|
13
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
14
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function () { return e[k]; }
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
n["default"] = e;
|
|
22
|
+
return Object.freeze(n);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
26
|
+
|
|
7
27
|
/**
|
|
8
28
|
* To allow easy interactions with groups of related queries, such as
|
|
9
29
|
* invalidating all queries of a router, we use an array as the path when
|
|
@@ -51,7 +71,7 @@ const contextProps = [
|
|
|
51
71
|
'ssrState',
|
|
52
72
|
'abortOnUnmount'
|
|
53
73
|
];
|
|
54
|
-
const TRPCContext =
|
|
74
|
+
const TRPCContext = React__namespace.createContext?.(null);
|
|
55
75
|
|
|
56
76
|
const getQueryType = (utilName)=>{
|
|
57
77
|
switch(utilName){
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createTRPCClientProxy } from '@trpc/client';
|
|
2
2
|
import { createFlatProxy, createRecursiveProxy } from '@trpc/core';
|
|
3
|
-
import
|
|
3
|
+
import * as React from 'react';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* To allow easy interactions with groups of related queries, such as
|
|
@@ -49,7 +49,7 @@ const contextProps = [
|
|
|
49
49
|
'ssrState',
|
|
50
50
|
'abortOnUnmount'
|
|
51
51
|
];
|
|
52
|
-
const TRPCContext =
|
|
52
|
+
const TRPCContext = React.createContext?.(null);
|
|
53
53
|
|
|
54
54
|
const getQueryType = (utilName)=>{
|
|
55
55
|
switch(utilName){
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createTRPCClientProxy } from '@trpc/client';
|
|
2
2
|
import { createFlatProxy, createRecursiveProxy } from '@trpc/core';
|
|
3
|
-
import
|
|
3
|
+
import * as React from 'react';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* To allow easy interactions with groups of related queries, such as
|
|
@@ -46,7 +46,7 @@ const contextProps = [
|
|
|
46
46
|
'ssrState',
|
|
47
47
|
'abortOnUnmount',
|
|
48
48
|
];
|
|
49
|
-
const TRPCContext = createContext(null);
|
|
49
|
+
const TRPCContext = React.createContext?.(null);
|
|
50
50
|
|
|
51
51
|
const getQueryType = (utilName) => {
|
|
52
52
|
switch (utilName) {
|
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.204+e37e719b3",
|
|
4
4
|
"description": "The tRPC React library",
|
|
5
5
|
"author": "KATT",
|
|
6
6
|
"license": "MIT",
|
|
@@ -57,17 +57,17 @@
|
|
|
57
57
|
}
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@trpc/core": "11.0.0-next-beta.
|
|
60
|
+
"@trpc/core": "11.0.0-next-beta.204+e37e719b3"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
63
|
"@tanstack/react-query": "^5.0.0",
|
|
64
|
-
"@trpc/client": "11.0.0-next-beta.
|
|
64
|
+
"@trpc/client": "11.0.0-next-beta.204+e37e719b3",
|
|
65
65
|
"react": ">=18.2.0",
|
|
66
66
|
"react-dom": ">=18.2.0"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
69
|
"@tanstack/react-query": "^5.0.0",
|
|
70
|
-
"@trpc/client": "11.0.0-next-beta.
|
|
70
|
+
"@trpc/client": "11.0.0-next-beta.204+e37e719b3",
|
|
71
71
|
"@types/express": "^4.17.17",
|
|
72
72
|
"@types/node": "^20.10.0",
|
|
73
73
|
"@types/react": "^18.2.33",
|
|
@@ -86,5 +86,5 @@
|
|
|
86
86
|
"funding": [
|
|
87
87
|
"https://trpc.io/sponsor"
|
|
88
88
|
],
|
|
89
|
-
"gitHead": "
|
|
89
|
+
"gitHead": "e37e719b356f39931f1188df6a6e06c98f4e849c"
|
|
90
90
|
}
|
package/src/createTRPCReact.tsx
CHANGED
|
@@ -13,7 +13,7 @@ import type {
|
|
|
13
13
|
ProtectedIntersection,
|
|
14
14
|
} from '@trpc/core';
|
|
15
15
|
import { createFlatProxy } from '@trpc/core';
|
|
16
|
-
import
|
|
16
|
+
import * as React from 'react';
|
|
17
17
|
import type {
|
|
18
18
|
TRPCUseQueries,
|
|
19
19
|
TRPCUseSuspenseQueries,
|
|
@@ -288,7 +288,7 @@ export function createHooksInternal<
|
|
|
288
288
|
return () => {
|
|
289
289
|
const context = trpc.useUtils();
|
|
290
290
|
// create a stable reference of the utils context
|
|
291
|
-
return useMemo(() => {
|
|
291
|
+
return React.useMemo(() => {
|
|
292
292
|
return (createReactQueryUtils as any)(context);
|
|
293
293
|
}, [context]);
|
|
294
294
|
};
|
|
@@ -20,7 +20,7 @@ import type {
|
|
|
20
20
|
TRPCUntypedClient,
|
|
21
21
|
} from '@trpc/client';
|
|
22
22
|
import type { AnyRouter, DistributiveOmit } from '@trpc/core';
|
|
23
|
-
import
|
|
23
|
+
import * as React from 'react';
|
|
24
24
|
import type { ExtractCursorType } from '../shared';
|
|
25
25
|
import type { TRPCQueryKey } from './getQueryKey';
|
|
26
26
|
|
|
@@ -226,4 +226,4 @@ export interface TRPCQueryUtils<TRouter extends AnyRouter> {
|
|
|
226
226
|
queryKey: TRPCQueryKey,
|
|
227
227
|
) => InfiniteData<unknown> | undefined;
|
|
228
228
|
}
|
|
229
|
-
export const TRPCContext = createContext(null as any);
|
|
229
|
+
export const TRPCContext = React.createContext?.(null as any);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
|
|
3
3
|
export interface TRPCHookResult {
|
|
4
4
|
trpc: {
|
|
@@ -12,7 +12,7 @@ export interface TRPCHookResult {
|
|
|
12
12
|
export function useHookResult(
|
|
13
13
|
value: TRPCHookResult['trpc'],
|
|
14
14
|
): TRPCHookResult['trpc'] {
|
|
15
|
-
const ref = useRef(value);
|
|
15
|
+
const ref = React.useRef(value);
|
|
16
16
|
ref.current.path = value.path;
|
|
17
17
|
return ref.current;
|
|
18
18
|
}
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
import type { TRPCClientErrorLike } from '@trpc/client';
|
|
14
14
|
import { createTRPCUntypedClient } from '@trpc/client';
|
|
15
15
|
import type { AnyRouter } from '@trpc/core';
|
|
16
|
-
import
|
|
16
|
+
import * as React from 'react';
|
|
17
17
|
import type { SSRState, TRPCContextState } from '../../internals/context';
|
|
18
18
|
import { TRPCContext } from '../../internals/context';
|
|
19
19
|
import { getClientArgs } from '../../internals/getClientArgs';
|
|
@@ -69,9 +69,11 @@ export function createRootHooks<
|
|
|
69
69
|
|
|
70
70
|
const TRPCProvider: TRPCProvider<TRouter, TSSRContext> = (props) => {
|
|
71
71
|
const { abortOnUnmount = false, client, queryClient, ssrContext } = props;
|
|
72
|
-
const [ssrState, setSSRState] = useState<SSRState>(
|
|
72
|
+
const [ssrState, setSSRState] = React.useState<SSRState>(
|
|
73
|
+
props.ssrState ?? false,
|
|
74
|
+
);
|
|
73
75
|
|
|
74
|
-
const fns = useMemo(
|
|
76
|
+
const fns = React.useMemo(
|
|
75
77
|
() =>
|
|
76
78
|
createUtilityFunctions({
|
|
77
79
|
client,
|
|
@@ -80,7 +82,7 @@ export function createRootHooks<
|
|
|
80
82
|
[client, queryClient],
|
|
81
83
|
);
|
|
82
84
|
|
|
83
|
-
const contextValue = useMemo<ProviderContext>(
|
|
85
|
+
const contextValue = React.useMemo<ProviderContext>(
|
|
84
86
|
() => ({
|
|
85
87
|
abortOnUnmount,
|
|
86
88
|
queryClient,
|
|
@@ -92,7 +94,7 @@ export function createRootHooks<
|
|
|
92
94
|
[abortOnUnmount, client, fns, queryClient, ssrContext, ssrState],
|
|
93
95
|
);
|
|
94
96
|
|
|
95
|
-
useEffect(() => {
|
|
97
|
+
React.useEffect(() => {
|
|
96
98
|
// Only updating state to `mounted` if we are using SSR.
|
|
97
99
|
// This makes it so we don't have an unnecessary re-render when opting out of SSR.
|
|
98
100
|
setSSRState((state) => (state ? 'mounted' : false));
|
|
@@ -275,10 +277,10 @@ export function createRootHooks<
|
|
|
275
277
|
const queryKey = hashKey(getQueryKeyInternal(path, input, 'any'));
|
|
276
278
|
const { client } = useContext();
|
|
277
279
|
|
|
278
|
-
const optsRef = useRef<typeof opts>(opts);
|
|
280
|
+
const optsRef = React.useRef<typeof opts>(opts);
|
|
279
281
|
optsRef.current = opts;
|
|
280
282
|
|
|
281
|
-
useEffect(() => {
|
|
283
|
+
React.useEffect(() => {
|
|
282
284
|
if (!enabled) {
|
|
283
285
|
return;
|
|
284
286
|
}
|
|
@@ -492,7 +494,7 @@ export function createRootHooks<
|
|
|
492
494
|
client,
|
|
493
495
|
trpcState,
|
|
494
496
|
) => {
|
|
495
|
-
const transformed: DehydratedState | undefined = useMemo(() => {
|
|
497
|
+
const transformed: DehydratedState | undefined = React.useMemo(() => {
|
|
496
498
|
if (!trpcState) {
|
|
497
499
|
return trpcState;
|
|
498
500
|
}
|