@trpc/react-query 10.45.1-canary.23 → 10.45.1-canary.24

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.
@@ -1,7 +1,7 @@
1
1
  {
2
- "bundleSize": 28654,
3
- "bundleOrigSize": 82932,
4
- "bundleReduction": 65.45,
2
+ "bundleSize": 28671,
3
+ "bundleOrigSize": 82919,
4
+ "bundleReduction": 65.42,
5
5
  "modules": [
6
6
  {
7
7
  "id": "/src/shared/hooks/createHooksInternal.tsx",
@@ -14,7 +14,7 @@
14
14
  "dependents": [
15
15
  "/src/shared/hooks/deprecated/createHooksInternal.tsx"
16
16
  ],
17
- "percent": 55.5,
17
+ "percent": 55.47,
18
18
  "reduction": 6.72
19
19
  },
20
20
  {
@@ -42,7 +42,7 @@
42
42
  "dependents": [
43
43
  "/src/shared/index.ts"
44
44
  ],
45
- "percent": 8.99,
45
+ "percent": 8.98,
46
46
  "reduction": 72.71
47
47
  },
48
48
  {
@@ -56,7 +56,7 @@
56
56
  "dependents": [
57
57
  "/src/shared/index.ts"
58
58
  ],
59
- "percent": 5.36,
59
+ "percent": 5.35,
60
60
  "reduction": 12.39
61
61
  },
62
62
  {
@@ -106,7 +106,7 @@
106
106
  "/src/shared/proxy/utilsProxy.ts",
107
107
  "/src/shared/proxy/useQueriesProxy.ts"
108
108
  ],
109
- "percent": 3.12,
109
+ "percent": 3.11,
110
110
  "reduction": 69.87
111
111
  },
112
112
  {
@@ -157,8 +157,8 @@
157
157
  },
158
158
  {
159
159
  "id": "/src/internals/useHookResult.ts",
160
- "size": 184,
161
- "origSize": 336,
160
+ "size": 201,
161
+ "origSize": 323,
162
162
  "renderedExports": [
163
163
  "useHookResult"
164
164
  ],
@@ -167,8 +167,8 @@
167
167
  "/src/shared/hooks/createHooksInternal.tsx",
168
168
  "/src/shared/hooks/deprecated/createHooksInternal.tsx"
169
169
  ],
170
- "percent": 0.64,
171
- "reduction": 45.24
170
+ "percent": 0.7,
171
+ "reduction": 37.77
172
172
  },
173
173
  {
174
174
  "id": "/src/internals/context.tsx",
@@ -2,7 +2,7 @@ import { createRecursiveProxy, createFlatProxy } from '@trpc/server/shared';
2
2
  import { g as getArrayQueryKey } from './getArrayQueryKey-86134f8b.mjs';
3
3
  import { createTRPCClientProxy, createTRPCClient } from '@trpc/client';
4
4
  import { useQuery, useQueryClient, useMutation, hashQueryKey, useInfiniteQuery, useQueries } from '@tanstack/react-query';
5
- import React, { createContext, useRef, useState, useEffect, useCallback, useMemo } from 'react';
5
+ import React, { createContext, useMemo, useState, useEffect, useCallback, useRef } from 'react';
6
6
 
7
7
  /**
8
8
  * We treat `undefined` as an input the same as omitting an `input`
@@ -179,9 +179,12 @@ function getClientArgs(pathAndInput, opts) {
179
179
  /**
180
180
  * Makes a stable reference of the `trpc` prop
181
181
  */ function useHookResult(value) {
182
- const ref = useRef(value);
183
- ref.current.path = value.path;
184
- return ref.current;
182
+ const { path } = value;
183
+ return useMemo(()=>({
184
+ path
185
+ }), [
186
+ path
187
+ ]);
185
188
  }
186
189
 
187
190
  /**
@@ -2,7 +2,7 @@ import { createRecursiveProxy, createFlatProxy } from '@trpc/server/shared';
2
2
  import { g as getArrayQueryKey, c as contextProps, T as TRPCContext } from './context-4557b3d3.js';
3
3
  import { createTRPCClientProxy, createTRPCClient } from '@trpc/client';
4
4
  import { useQuery, useQueryClient, useMutation, hashQueryKey, useInfiniteQuery, useQueries } from '@tanstack/react-query';
5
- import React, { useRef, useState, useEffect, useCallback, useMemo } from 'react';
5
+ import React, { useMemo, useState, useEffect, useCallback, useRef } from 'react';
6
6
 
7
7
  /**
8
8
  * We treat `undefined` as an input the same as omitting an `input`
@@ -157,9 +157,8 @@ function getClientArgs(pathAndInput, opts) {
157
157
  * Makes a stable reference of the `trpc` prop
158
158
  */
159
159
  function useHookResult(value) {
160
- const ref = useRef(value);
161
- ref.current.path = value.path;
162
- return ref.current;
160
+ const { path } = value;
161
+ return useMemo(() => ({ path }), [path]);
163
162
  }
164
163
 
165
164
  /**
@@ -185,9 +185,12 @@ function getClientArgs(pathAndInput, opts) {
185
185
  /**
186
186
  * Makes a stable reference of the `trpc` prop
187
187
  */ function useHookResult(value) {
188
- const ref = React.useRef(value);
189
- ref.current.path = value.path;
190
- return ref.current;
188
+ const { path } = value;
189
+ return React.useMemo(()=>({
190
+ path
191
+ }), [
192
+ path
193
+ ]);
191
194
  }
192
195
 
193
196
  /**
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var client = require('@trpc/client');
6
- var createHooksInternal = require('./createHooksInternal-2e69c447.js');
6
+ var createHooksInternal = require('./createHooksInternal-d1a331c0.js');
7
7
  var shared = require('@trpc/server/shared');
8
8
  var React = require('react');
9
9
  require('@tanstack/react-query');
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  export * from '@trpc/client';
2
- import { c as createHooksInternal, a as createReactQueryUtilsProxy, b as createReactProxyDecoration } from './createHooksInternal-bdff7171.mjs';
3
- export { g as getQueryKey } from './createHooksInternal-bdff7171.mjs';
2
+ import { c as createHooksInternal, a as createReactQueryUtilsProxy, b as createReactProxyDecoration } from './createHooksInternal-063195fc.mjs';
3
+ export { g as getQueryKey } from './createHooksInternal-063195fc.mjs';
4
4
  import { createFlatProxy } from '@trpc/server/shared';
5
5
  import { useMemo } from 'react';
6
6
  import '@tanstack/react-query';
@@ -1 +1 @@
1
- {"version":3,"file":"useHookResult.d.ts","sourceRoot":"","sources":["../../src/internals/useHookResult.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;CACH;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,cAAc,CAAC,MAAM,CAAC,GAC5B,cAAc,CAAC,MAAM,CAAC,CAIxB"}
1
+ {"version":3,"file":"useHookResult.d.ts","sourceRoot":"","sources":["../../src/internals/useHookResult.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;CACH;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,cAAc,CAAC,MAAM,CAAC,GAC5B,cAAc,CAAC,MAAM,CAAC,CAGxB"}
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var createHooksInternal = require('../createHooksInternal-2e69c447.js');
5
+ var createHooksInternal = require('../createHooksInternal-d1a331c0.js');
6
6
  var queryClient = require('../queryClient-358a9a75.js');
7
7
  require('@trpc/server/shared');
8
8
  require('../getArrayQueryKey-4bdb5cc2.js');
@@ -1,4 +1,4 @@
1
- export { T as TRPCContext, h as contextProps, c as createHooksInternal, b as createReactProxyDecoration, a as createReactQueryUtilsProxy, f as createRootHooks, e as createUseQueriesProxy, d as getClientArgs } from '../createHooksInternal-bdff7171.mjs';
1
+ export { T as TRPCContext, h as contextProps, c as createHooksInternal, b as createReactProxyDecoration, a as createReactQueryUtilsProxy, f as createRootHooks, e as createUseQueriesProxy, d as getClientArgs } from '../createHooksInternal-063195fc.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.45.1-canary.23+0d93bc947",
3
+ "version": "10.45.1-canary.24+3bdb43bde",
4
4
  "description": "The tRPC React library",
5
5
  "author": "KATT",
6
6
  "license": "MIT",
@@ -64,15 +64,15 @@
64
64
  },
65
65
  "peerDependencies": {
66
66
  "@tanstack/react-query": "^4.18.0",
67
- "@trpc/client": "10.45.1-canary.23+0d93bc947",
68
- "@trpc/server": "10.45.1-canary.23+0d93bc947",
67
+ "@trpc/client": "10.45.1-canary.24+3bdb43bde",
68
+ "@trpc/server": "10.45.1-canary.24+3bdb43bde",
69
69
  "react": ">=16.8.0",
70
70
  "react-dom": ">=16.8.0"
71
71
  },
72
72
  "devDependencies": {
73
73
  "@tanstack/react-query": "^4.18.0",
74
- "@trpc/client": "10.45.1-canary.23+0d93bc947",
75
- "@trpc/server": "10.45.1-canary.23+0d93bc947",
74
+ "@trpc/client": "10.45.1-canary.24+3bdb43bde",
75
+ "@trpc/server": "10.45.1-canary.24+3bdb43bde",
76
76
  "@types/express": "^4.17.17",
77
77
  "@types/node": "^20.10.0",
78
78
  "@types/react": "^18.2.33",
@@ -91,5 +91,5 @@
91
91
  "funding": [
92
92
  "https://trpc.io/sponsor"
93
93
  ],
94
- "gitHead": "0d93bc947ab7b4aa298ec288a3f296c5d76b2707"
94
+ "gitHead": "3bdb43bdeb3f02850a67048ae2cf9b6be69b9ede"
95
95
  }
@@ -1,4 +1,4 @@
1
- import { useRef } from 'react';
1
+ import { useMemo } from 'react';
2
2
 
3
3
  export interface TRPCHookResult {
4
4
  trpc: {
@@ -12,7 +12,6 @@ export interface TRPCHookResult {
12
12
  export function useHookResult(
13
13
  value: TRPCHookResult['trpc'],
14
14
  ): TRPCHookResult['trpc'] {
15
- const ref = useRef(value);
16
- ref.current.path = value.path;
17
- return ref.current;
15
+ const { path } = value;
16
+ return useMemo(() => ({ path }), [path]);
18
17
  }