@trpc/react-query 11.0.0-alpha-tmp-react-sideeffects-import.202 → 11.0.0-alpha-tmp-opt-peers.203

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,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 * as React from 'react';
5
- import { b as getQueryKeyInternal, T as TRPCContext } from './utilsProxy-ff357a62.js';
4
+ import React, { useRef, useState, useMemo, useEffect } from 'react';
5
+ import { b as getQueryKeyInternal, T as TRPCContext } from './utilsProxy-c08ebe6e.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 = React.useRef(value);
66
+ const ref = 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] = React.useState(props.ssrState ?? false);
174
- const fns = React.useMemo(() => createUtilityFunctions({
173
+ const [ssrState, setSSRState] = useState(props.ssrState ?? false);
174
+ const fns = useMemo(() => createUtilityFunctions({
175
175
  client,
176
176
  queryClient,
177
177
  }), [client, queryClient]);
178
- const contextValue = React.useMemo(() => ({
178
+ const contextValue = 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
- React.useEffect(() => {
186
+ 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 = React.useRef(opts);
308
+ const optsRef = useRef(opts);
309
309
  optsRef.current = opts;
310
- React.useEffect(() => {
310
+ 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 = React.useMemo(() => {
445
+ const transformed = useMemo(() => {
446
446
  if (!trpcState) {
447
447
  return trpcState;
448
448
  }
@@ -4,27 +4,11 @@ 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-0b88c1e3.js');
7
+ var utilsProxy = require('./utilsProxy-f0fe7c68.js');
8
8
 
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
- }
9
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
26
10
 
27
- var React__namespace = /*#__PURE__*/_interopNamespace(React);
11
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
28
12
 
29
13
  /**
30
14
  * Create proxy for decorating procedures
@@ -87,7 +71,7 @@ var React__namespace = /*#__PURE__*/_interopNamespace(React);
87
71
  /**
88
72
  * Makes a stable reference of the `trpc` prop
89
73
  */ function useHookResult(value) {
90
- const ref = React__namespace.useRef(value);
74
+ const ref = React.useRef(value);
91
75
  ref.current.path = value.path;
92
76
  return ref.current;
93
77
  }
@@ -190,15 +174,15 @@ var React__namespace = /*#__PURE__*/_interopNamespace(React);
190
174
  };
191
175
  const TRPCProvider = (props)=>{
192
176
  const { abortOnUnmount =false , client , queryClient , ssrContext } = props;
193
- const [ssrState, setSSRState] = React__namespace.useState(props.ssrState ?? false);
194
- const fns = React__namespace.useMemo(()=>createUtilityFunctions({
177
+ const [ssrState, setSSRState] = React.useState(props.ssrState ?? false);
178
+ const fns = React.useMemo(()=>createUtilityFunctions({
195
179
  client,
196
180
  queryClient
197
181
  }), [
198
182
  client,
199
183
  queryClient
200
184
  ]);
201
- const contextValue = React__namespace.useMemo(()=>({
185
+ const contextValue = React.useMemo(()=>({
202
186
  abortOnUnmount,
203
187
  queryClient,
204
188
  client,
@@ -213,17 +197,17 @@ var React__namespace = /*#__PURE__*/_interopNamespace(React);
213
197
  ssrContext,
214
198
  ssrState
215
199
  ]);
216
- React__namespace.useEffect(()=>{
200
+ React.useEffect(()=>{
217
201
  // Only updating state to `mounted` if we are using SSR.
218
202
  // This makes it so we don't have an unnecessary re-render when opting out of SSR.
219
203
  setSSRState((state)=>state ? 'mounted' : false);
220
204
  }, []);
221
- return /*#__PURE__*/ React__namespace.createElement(Context.Provider, {
205
+ return /*#__PURE__*/ React__default["default"].createElement(Context.Provider, {
222
206
  value: contextValue
223
207
  }, props.children);
224
208
  };
225
209
  function useContext() {
226
- const context = React__namespace.useContext(Context);
210
+ const context = React__default["default"].useContext(Context);
227
211
  if (!context) {
228
212
  throw new Error('Unable to find tRPC Context. Did you forget to wrap your App inside `withTRPC` HoC?');
229
213
  }
@@ -339,9 +323,9 @@ var React__namespace = /*#__PURE__*/_interopNamespace(React);
339
323
  const enabled = opts?.enabled ?? true;
340
324
  const queryKey = reactQuery.hashKey(utilsProxy.getQueryKeyInternal(path, input, 'any'));
341
325
  const { client } = useContext();
342
- const optsRef = React__namespace.useRef(opts);
326
+ const optsRef = React.useRef(opts);
343
327
  optsRef.current = opts;
344
- React__namespace.useEffect(()=>{
328
+ React.useEffect(()=>{
345
329
  if (!enabled) {
346
330
  return;
347
331
  }
@@ -487,7 +471,7 @@ var React__namespace = /*#__PURE__*/_interopNamespace(React);
487
471
  ];
488
472
  };
489
473
  const useDehydratedState = (client, trpcState)=>{
490
- const transformed = React__namespace.useMemo(()=>{
474
+ const transformed = React.useMemo(()=>{
491
475
  if (!trpcState) {
492
476
  return trpcState;
493
477
  }
@@ -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 * as React from 'react';
5
- import { b as getQueryKeyInternal, T as TRPCContext } from './utilsProxy-61a4601f.mjs';
4
+ import React, { useRef, useState, useMemo, useEffect } from 'react';
5
+ import { b as getQueryKeyInternal, T as TRPCContext } from './utilsProxy-5402e992.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-61a4601
65
65
  /**
66
66
  * Makes a stable reference of the `trpc` prop
67
67
  */ function useHookResult(value) {
68
- const ref = React.useRef(value);
68
+ const ref = 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-61a4601
168
168
  };
169
169
  const TRPCProvider = (props)=>{
170
170
  const { abortOnUnmount =false , client , queryClient , ssrContext } = props;
171
- const [ssrState, setSSRState] = React.useState(props.ssrState ?? false);
172
- const fns = React.useMemo(()=>createUtilityFunctions({
171
+ const [ssrState, setSSRState] = useState(props.ssrState ?? false);
172
+ const fns = useMemo(()=>createUtilityFunctions({
173
173
  client,
174
174
  queryClient
175
175
  }), [
176
176
  client,
177
177
  queryClient
178
178
  ]);
179
- const contextValue = React.useMemo(()=>({
179
+ const contextValue = useMemo(()=>({
180
180
  abortOnUnmount,
181
181
  queryClient,
182
182
  client,
@@ -191,7 +191,7 @@ import { b as getQueryKeyInternal, T as TRPCContext } from './utilsProxy-61a4601
191
191
  ssrContext,
192
192
  ssrState
193
193
  ]);
194
- React.useEffect(()=>{
194
+ 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-61a4601
317
317
  const enabled = opts?.enabled ?? true;
318
318
  const queryKey = hashKey(getQueryKeyInternal(path, input, 'any'));
319
319
  const { client } = useContext();
320
- const optsRef = React.useRef(opts);
320
+ const optsRef = useRef(opts);
321
321
  optsRef.current = opts;
322
- React.useEffect(()=>{
322
+ useEffect(()=>{
323
323
  if (!enabled) {
324
324
  return;
325
325
  }
@@ -465,7 +465,7 @@ import { b as getQueryKeyInternal, T as TRPCContext } from './utilsProxy-61a4601
465
465
  ];
466
466
  };
467
467
  const useDehydratedState = (client, trpcState)=>{
468
- const transformed = React.useMemo(()=>{
468
+ const transformed = useMemo(()=>{
469
469
  if (!trpcState) {
470
470
  return trpcState;
471
471
  }
package/dist/index.js CHANGED
@@ -3,32 +3,12 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var client = require('@trpc/client');
6
- var utilsProxy = require('./utilsProxy-0b88c1e3.js');
6
+ var utilsProxy = require('./utilsProxy-f0fe7c68.js');
7
7
  var core = require('@trpc/core');
8
8
  var React = require('react');
9
- var createHooksInternal$1 = require('./createHooksInternal-5d2fa367.js');
9
+ var createHooksInternal$1 = require('./createHooksInternal-6c0232d7.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
-
32
12
  /**
33
13
  * @internal
34
14
  */ function createHooksInternal(trpc) {
@@ -37,7 +17,7 @@ var React__namespace = /*#__PURE__*/_interopNamespace(React);
37
17
  return ()=>{
38
18
  const context = trpc.useUtils();
39
19
  // create a stable reference of the utils context
40
- return React__namespace.useMemo(()=>{
20
+ return React.useMemo(()=>{
41
21
  return utilsProxy.createReactQueryUtils(context);
42
22
  }, [
43
23
  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-61a4601f.mjs';
3
- export { g as getQueryKey } from './utilsProxy-61a4601f.mjs';
2
+ import { c as createReactQueryUtils, a as createQueryUtilsProxy } from './utilsProxy-5402e992.mjs';
3
+ export { g as getQueryKey } from './utilsProxy-5402e992.mjs';
4
4
  import { createFlatProxy } from '@trpc/core';
5
- import * as React from 'react';
6
- import { c as createRootHooks, a as createReactDecoration, b as createUtilityFunctions } from './createHooksInternal-e0b0564e.mjs';
5
+ import { useMemo } from 'react';
6
+ import { c as createRootHooks, a as createReactDecoration, b as createUtilityFunctions } from './createHooksInternal-df9ecb1f.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 React.useMemo(()=>{
17
+ return useMemo(()=>{
18
18
  return createReactQueryUtils(context);
19
19
  }, [
20
20
  context
@@ -1,7 +1,7 @@
1
+ /// <reference types="react" />
1
2
  import type { CancelOptions, FetchInfiniteQueryOptions, FetchQueryOptions, InfiniteData, InvalidateOptions, InvalidateQueryFilters, QueryClient, QueryFilters, RefetchOptions, RefetchQueryFilters, ResetOptions, SetDataOptions, Updater } from '@tanstack/react-query';
2
3
  import type { CreateTRPCClient, TRPCClientError, TRPCRequestOptions, TRPCUntypedClient } from '@trpc/client';
3
4
  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: React.Context<any>;
114
+ export declare const TRPCContext: import("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":"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,c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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"}
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;AAE9D,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,CAAC,CAC1B,EACD,UAAU,GAAG,kBAAkB,CAChC,GACC,kBAAkB,GAAG;IACnB,aAAa,CAAC,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC;CAC3C,CAAC;AAEN,gBAAgB;AAChB,MAAM,MAAM,QAAQ,GAAG,SAA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E,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,8BAA6B,CAAC"}
@@ -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-0b88c1e3.js');
8
+ var utilsProxy = require('../utilsProxy-f0fe7c68.js');
9
9
  require('react');
10
10
  var queryClient = require('../queryClient-358a9a75.js');
11
11
 
@@ -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-61a4601f.mjs';
4
+ import { b as getQueryKeyInternal, d as getQueryType } from '../utilsProxy-5402e992.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;;;;;qBAmFhC,MAAM,EAAE,SACP,OAAO;6BAwDR,MAAM,EAAE,SACP,OAAO;;;wBAsCR,MAAM,EAAE;4BAuCR,MAAM,EAAE,SACP,OAAO;;6BA6CR,MAAM,EAAE,SACP,OAAO;qCAoER,MAAM,EAAE,SACP,OAAO;EAsIjB;AAED;;;GAGG;AACH,cAAM,OAAO,CAAC,OAAO,SAAS,SAAS,EAAE,WAAW,GAAG,OAAO;IAC5D,EAAE;;;;;;;;;;;;;;;CAGH;AAED,KAAK,iBAAiB,CAAC,KAAK,IAAI,KAAK,SAAS,CAC5C,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KACtB,MAAM,CAAC,GACR,CAAC,GACD,KAAK,CAAC;AACV,KAAK,OAAO,CAAC,OAAO,SAAS,SAAS,EAAE,WAAW,GAAG,OAAO,IAAI,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"}
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;;;;;qBAiFhC,MAAM,EAAE,SACP,OAAO;6BAwDR,MAAM,EAAE,SACP,OAAO;;;wBAsCR,MAAM,EAAE;4BAuCR,MAAM,EAAE,SACP,OAAO;;6BA6CR,MAAM,EAAE,SACP,OAAO;qCAoER,MAAM,EAAE,SACP,OAAO;EAsIjB;AAED;;;GAGG;AACH,cAAM,OAAO,CAAC,OAAO,SAAS,SAAS,EAAE,WAAW,GAAG,OAAO;IAC5D,EAAE;;;;;;;;;;;;;;;CAGH;AAED,KAAK,iBAAiB,CAAC,KAAK,IAAI,KAAK,SAAS,CAC5C,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KACtB,MAAM,CAAC,GACR,CAAC,GACD,KAAK,CAAC;AACV,KAAK,OAAO,CAAC,OAAO,SAAS,SAAS,EAAE,WAAW,GAAG,OAAO,IAAI,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"}
@@ -2,8 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var createHooksInternal = require('../createHooksInternal-5d2fa367.js');
6
- var utilsProxy = require('../utilsProxy-0b88c1e3.js');
5
+ var createHooksInternal = require('../createHooksInternal-6c0232d7.js');
6
+ var utilsProxy = require('../utilsProxy-f0fe7c68.js');
7
7
  var queryClient = require('../queryClient-358a9a75.js');
8
8
  require('@trpc/core');
9
9
  require('@tanstack/react-query');
@@ -1,5 +1,5 @@
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';
1
+ export { a as createReactDecoration, c as createRootHooks, d as createUseQueries, g as getClientArgs } from '../createHooksInternal-df9ecb1f.mjs';
2
+ export { T as TRPCContext, e as contextProps, a as createQueryUtilsProxy, c as createReactQueryUtils, d as getQueryType } from '../utilsProxy-5402e992.mjs';
3
3
  export { g as getQueryClient } from '../queryClient-4d766c0c.mjs';
4
4
  import '@trpc/core';
5
5
  import '@tanstack/react-query';
@@ -1,6 +1,6 @@
1
1
  import { createTRPCClientProxy } from '@trpc/client';
2
2
  import { createFlatProxy, createRecursiveProxy } from '@trpc/core';
3
- import * as React from 'react';
3
+ import { createContext } 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 = React.createContext?.(null);
52
+ const TRPCContext = /*#__PURE__*/ 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 * as React from 'react';
3
+ import { createContext } 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 = React.createContext?.(null);
49
+ const TRPCContext = createContext(null);
50
50
 
51
51
  const getQueryType = (utilName) => {
52
52
  switch (utilName) {
@@ -4,26 +4,6 @@ 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
-
27
7
  /**
28
8
  * To allow easy interactions with groups of related queries, such as
29
9
  * invalidating all queries of a router, we use an array as the path when
@@ -71,7 +51,7 @@ const contextProps = [
71
51
  'ssrState',
72
52
  'abortOnUnmount'
73
53
  ];
74
- const TRPCContext = React__namespace.createContext?.(null);
54
+ const TRPCContext = /*#__PURE__*/ React.createContext(null);
75
55
 
76
56
  const getQueryType = (utilName)=>{
77
57
  switch(utilName){
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trpc/react-query",
3
- "version": "11.0.0-alpha-tmp-react-sideeffects-import.202+204981c56",
3
+ "version": "11.0.0-alpha-tmp-opt-peers.203+092381a94",
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-alpha-tmp-react-sideeffects-import.202+204981c56"
60
+ "@trpc/core": "11.0.0-alpha-tmp-opt-peers.203+092381a94"
61
61
  },
62
62
  "peerDependencies": {
63
63
  "@tanstack/react-query": "^5.0.0",
64
- "@trpc/client": "11.0.0-alpha-tmp-react-sideeffects-import.202+204981c56",
64
+ "@trpc/client": "11.0.0-alpha-tmp-opt-peers.203+092381a94",
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-alpha-tmp-react-sideeffects-import.202+204981c56",
70
+ "@trpc/client": "11.0.0-alpha-tmp-opt-peers.203+092381a94",
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": "204981c566792cc1dc72be3d0bb94750a6f476dc"
89
+ "gitHead": "092381a940020c95b4ca7b69760230db41440f1d"
90
90
  }
@@ -13,7 +13,7 @@ import type {
13
13
  ProtectedIntersection,
14
14
  } from '@trpc/core';
15
15
  import { createFlatProxy } from '@trpc/core';
16
- import * as React from 'react';
16
+ import { useMemo } 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 React.useMemo(() => {
291
+ return 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 * as React from 'react';
23
+ import { createContext } 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 = React.createContext?.(null as any);
229
+ export const TRPCContext = createContext(null as any);
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ import { useRef } 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 = React.useRef(value);
15
+ const ref = 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 * as React from 'react';
16
+ import React, { useEffect, useMemo, useRef, useState } 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,11 +69,9 @@ 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] = React.useState<SSRState>(
73
- props.ssrState ?? false,
74
- );
72
+ const [ssrState, setSSRState] = useState<SSRState>(props.ssrState ?? false);
75
73
 
76
- const fns = React.useMemo(
74
+ const fns = useMemo(
77
75
  () =>
78
76
  createUtilityFunctions({
79
77
  client,
@@ -82,7 +80,7 @@ export function createRootHooks<
82
80
  [client, queryClient],
83
81
  );
84
82
 
85
- const contextValue = React.useMemo<ProviderContext>(
83
+ const contextValue = useMemo<ProviderContext>(
86
84
  () => ({
87
85
  abortOnUnmount,
88
86
  queryClient,
@@ -94,7 +92,7 @@ export function createRootHooks<
94
92
  [abortOnUnmount, client, fns, queryClient, ssrContext, ssrState],
95
93
  );
96
94
 
97
- React.useEffect(() => {
95
+ useEffect(() => {
98
96
  // Only updating state to `mounted` if we are using SSR.
99
97
  // This makes it so we don't have an unnecessary re-render when opting out of SSR.
100
98
  setSSRState((state) => (state ? 'mounted' : false));
@@ -277,10 +275,10 @@ export function createRootHooks<
277
275
  const queryKey = hashKey(getQueryKeyInternal(path, input, 'any'));
278
276
  const { client } = useContext();
279
277
 
280
- const optsRef = React.useRef<typeof opts>(opts);
278
+ const optsRef = useRef<typeof opts>(opts);
281
279
  optsRef.current = opts;
282
280
 
283
- React.useEffect(() => {
281
+ useEffect(() => {
284
282
  if (!enabled) {
285
283
  return;
286
284
  }
@@ -494,7 +492,7 @@ export function createRootHooks<
494
492
  client,
495
493
  trpcState,
496
494
  ) => {
497
- const transformed: DehydratedState | undefined = React.useMemo(() => {
495
+ const transformed: DehydratedState | undefined = useMemo(() => {
498
496
  if (!trpcState) {
499
497
  return trpcState;
500
498
  }