@trpc/react-query 10.8.2 → 10.9.0
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/{createHooksInternal-57a3cf21.js → createHooksInternal-aa6e50fa.js} +5 -2
- package/dist/{createHooksInternal-b83f2ee6.mjs → createHooksInternal-f795107e.mjs} +5 -2
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/shared/index.js +1 -1
- package/dist/shared/index.mjs +1 -1
- package/package.json +6 -6
- package/src/shared/hooks/createHooksInternal.tsx +3 -3
|
@@ -368,10 +368,13 @@ function getClientArgs(pathAndInput, opts) {
|
|
|
368
368
|
const queryClient = reactQuery.useQueryClient({
|
|
369
369
|
context: ReactQueryContext
|
|
370
370
|
});
|
|
371
|
+
const actualPath = Array.isArray(path) ? path[0] : path;
|
|
371
372
|
const hook = reactQuery.useMutation({
|
|
372
373
|
...opts,
|
|
374
|
+
mutationKey: [
|
|
375
|
+
actualPath.split('.')
|
|
376
|
+
],
|
|
373
377
|
mutationFn: (input)=>{
|
|
374
|
-
const actualPath = Array.isArray(path) ? path[0] : path;
|
|
375
378
|
return client.mutation(...getClientArgs([
|
|
376
379
|
actualPath,
|
|
377
380
|
input
|
|
@@ -388,7 +391,7 @@ function getClientArgs(pathAndInput, opts) {
|
|
|
388
391
|
}
|
|
389
392
|
});
|
|
390
393
|
hook.trpc = useHookResult({
|
|
391
|
-
path:
|
|
394
|
+
path: actualPath
|
|
392
395
|
});
|
|
393
396
|
return hook;
|
|
394
397
|
}
|
|
@@ -362,10 +362,13 @@ function getClientArgs(pathAndInput, opts) {
|
|
|
362
362
|
const queryClient = useQueryClient({
|
|
363
363
|
context: ReactQueryContext
|
|
364
364
|
});
|
|
365
|
+
const actualPath = Array.isArray(path) ? path[0] : path;
|
|
365
366
|
const hook = useMutation({
|
|
366
367
|
...opts,
|
|
368
|
+
mutationKey: [
|
|
369
|
+
actualPath.split('.')
|
|
370
|
+
],
|
|
367
371
|
mutationFn: (input)=>{
|
|
368
|
-
const actualPath = Array.isArray(path) ? path[0] : path;
|
|
369
372
|
return client.mutation(...getClientArgs([
|
|
370
373
|
actualPath,
|
|
371
374
|
input
|
|
@@ -382,7 +385,7 @@ function getClientArgs(pathAndInput, opts) {
|
|
|
382
385
|
}
|
|
383
386
|
});
|
|
384
387
|
hook.trpc = useHookResult({
|
|
385
|
-
path:
|
|
388
|
+
path: actualPath
|
|
386
389
|
});
|
|
387
390
|
return hook;
|
|
388
391
|
}
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var client = require('@trpc/client');
|
|
6
6
|
var shared = require('@trpc/server/shared');
|
|
7
7
|
var React = require('react');
|
|
8
|
-
var createHooksInternal = require('./createHooksInternal-
|
|
8
|
+
var createHooksInternal = require('./createHooksInternal-aa6e50fa.js');
|
|
9
9
|
require('@tanstack/react-query');
|
|
10
10
|
require('./getArrayQueryKey-4bdb5cc2.js');
|
|
11
11
|
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export * from '@trpc/client';
|
|
2
2
|
import { createFlatProxy } from '@trpc/server/shared';
|
|
3
3
|
import { useMemo } from 'react';
|
|
4
|
-
import { c as createHooksInternal, a as createReactQueryUtilsProxy, b as createReactProxyDecoration } from './createHooksInternal-
|
|
4
|
+
import { c as createHooksInternal, a as createReactQueryUtilsProxy, b as createReactProxyDecoration } from './createHooksInternal-f795107e.mjs';
|
|
5
5
|
import '@tanstack/react-query';
|
|
6
6
|
import './getArrayQueryKey-86134f8b.mjs';
|
|
7
7
|
|
package/dist/shared/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var createHooksInternal = require('../createHooksInternal-
|
|
5
|
+
var createHooksInternal = require('../createHooksInternal-aa6e50fa.js');
|
|
6
6
|
var queryClient = require('../queryClient-358a9a75.js');
|
|
7
7
|
require('@trpc/server/shared');
|
|
8
8
|
require('../getArrayQueryKey-4bdb5cc2.js');
|
package/dist/shared/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { T as TRPCContext, f as contextProps, c as createHooksInternal, b as createReactProxyDecoration, a as createReactQueryUtilsProxy, e as createRootHooks, d as createUseQueriesProxy, g as getClientArgs } from '../createHooksInternal-
|
|
1
|
+
export { T as TRPCContext, f as contextProps, c as createHooksInternal, b as createReactProxyDecoration, a as createReactQueryUtilsProxy, e as createRootHooks, d as createUseQueriesProxy, g as getClientArgs } from '../createHooksInternal-f795107e.mjs';
|
|
2
2
|
export { g as getQueryClient } from '../queryClient-4d766c0c.mjs';
|
|
3
3
|
import '@trpc/server/shared';
|
|
4
4
|
import '../getArrayQueryKey-86134f8b.mjs';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trpc/react-query",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.9.0",
|
|
4
4
|
"description": "tRPC React lib",
|
|
5
5
|
"author": "KATT",
|
|
6
6
|
"license": "MIT",
|
|
@@ -55,15 +55,15 @@
|
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
57
|
"@tanstack/react-query": "^4.3.8",
|
|
58
|
-
"@trpc/client": "10.
|
|
59
|
-
"@trpc/server": "10.
|
|
58
|
+
"@trpc/client": "10.9.0",
|
|
59
|
+
"@trpc/server": "10.9.0",
|
|
60
60
|
"react": ">=16.8.0",
|
|
61
61
|
"react-dom": ">=16.8.0"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"@tanstack/react-query": "^4.3.8",
|
|
65
|
-
"@trpc/client": "10.
|
|
66
|
-
"@trpc/server": "10.
|
|
65
|
+
"@trpc/client": "10.9.0",
|
|
66
|
+
"@trpc/server": "10.9.0",
|
|
67
67
|
"@types/express": "^4.17.12",
|
|
68
68
|
"@types/node": "^18.7.20",
|
|
69
69
|
"eslint": "^8.30.0",
|
|
@@ -78,5 +78,5 @@
|
|
|
78
78
|
"publishConfig": {
|
|
79
79
|
"access": "public"
|
|
80
80
|
},
|
|
81
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "3efac6213e5a488c9636b8b884fb755d38f12381"
|
|
82
82
|
}
|
|
@@ -311,12 +311,12 @@ export function createRootHooks<
|
|
|
311
311
|
): UseTRPCMutationResult<unknown, TError, unknown, unknown> {
|
|
312
312
|
const { client } = useContext();
|
|
313
313
|
const queryClient = useQueryClient({ context: ReactQueryContext });
|
|
314
|
+
const actualPath = Array.isArray(path) ? path[0] : path;
|
|
314
315
|
|
|
315
316
|
const hook = __useMutation({
|
|
316
317
|
...opts,
|
|
318
|
+
mutationKey: [actualPath.split('.')],
|
|
317
319
|
mutationFn: (input) => {
|
|
318
|
-
const actualPath = Array.isArray(path) ? path[0] : path;
|
|
319
|
-
|
|
320
320
|
return (client.mutation as any)(
|
|
321
321
|
...getClientArgs([actualPath, input], opts),
|
|
322
322
|
);
|
|
@@ -334,7 +334,7 @@ export function createRootHooks<
|
|
|
334
334
|
}) as UseTRPCMutationResult<unknown, TError, unknown, unknown>;
|
|
335
335
|
|
|
336
336
|
hook.trpc = useHookResult({
|
|
337
|
-
path:
|
|
337
|
+
path: actualPath,
|
|
338
338
|
});
|
|
339
339
|
|
|
340
340
|
return hook;
|