@trpc/react-query 11.0.0-rc.818 → 11.0.0-rc.819

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": 45008,
3
- "bundleOrigSize": 92893,
4
- "bundleReduction": 51.55,
2
+ "bundleSize": 45528,
3
+ "bundleOrigSize": 93288,
4
+ "bundleReduction": 51.2,
5
5
  "modules": [
6
6
  {
7
7
  "id": "/src/shared/hooks/createHooksInternal.tsx",
@@ -14,7 +14,7 @@
14
14
  "dependents": [
15
15
  "/src/createTRPCReact.tsx"
16
16
  ],
17
- "percent": 45.21,
17
+ "percent": 44.69,
18
18
  "reduction": 8.43
19
19
  },
20
20
  {
@@ -29,13 +29,13 @@
29
29
  "/src/createTRPCQueryUtils.tsx",
30
30
  "/src/shared/hooks/createHooksInternal.tsx"
31
31
  ],
32
- "percent": 16.05,
32
+ "percent": 15.87,
33
33
  "reduction": 0
34
34
  },
35
35
  {
36
36
  "id": "/src/server/ssgProxy.ts",
37
- "size": 3941,
38
- "origSize": 6045,
37
+ "size": 4461,
38
+ "origSize": 6440,
39
39
  "renderedExports": [
40
40
  "createServerSideHelpers"
41
41
  ],
@@ -43,8 +43,8 @@
43
43
  "dependents": [
44
44
  "/src/server/index.ts"
45
45
  ],
46
- "percent": 8.76,
47
- "reduction": 34.81
46
+ "percent": 9.8,
47
+ "reduction": 30.73
48
48
  },
49
49
  {
50
50
  "id": "/src/shared/proxy/utilsProxy.ts",
@@ -59,7 +59,7 @@
59
59
  "dependents": [
60
60
  "/src/shared/index.ts"
61
61
  ],
62
- "percent": 8.06,
62
+ "percent": 7.97,
63
63
  "reduction": 78.16
64
64
  },
65
65
  {
@@ -71,7 +71,7 @@
71
71
  ],
72
72
  "removedExports": [],
73
73
  "dependents": [],
74
- "percent": 7.18,
74
+ "percent": 7.09,
75
75
  "reduction": 40.13
76
76
  },
77
77
  {
@@ -88,12 +88,12 @@
88
88
  "dependents": [
89
89
  "/src/index.ts",
90
90
  "/src/rsc.tsx",
91
+ "/src/server/ssgProxy.ts",
91
92
  "/src/shared/proxy/utilsProxy.ts",
92
93
  "/src/shared/proxy/useQueriesProxy.ts",
93
- "/src/shared/hooks/createHooksInternal.tsx",
94
- "/src/server/ssgProxy.ts"
94
+ "/src/shared/hooks/createHooksInternal.tsx"
95
95
  ],
96
- "percent": 5.56,
96
+ "percent": 5.5,
97
97
  "reduction": 40.27
98
98
  },
99
99
  {
@@ -108,7 +108,7 @@
108
108
  "dependents": [
109
109
  "/src/index.ts"
110
110
  ],
111
- "percent": 1.94,
111
+ "percent": 1.92,
112
112
  "reduction": 93.61
113
113
  },
114
114
  {
@@ -125,7 +125,7 @@
125
125
  "/src/shared/hooks/createHooksInternal.tsx",
126
126
  "/src/utils/createUtilityFunctions.ts"
127
127
  ],
128
- "percent": 1.92,
128
+ "percent": 1.9,
129
129
  "reduction": 29.96
130
130
  },
131
131
  {
@@ -139,7 +139,7 @@
139
139
  "dependents": [
140
140
  "/src/shared/index.ts"
141
141
  ],
142
- "percent": 1.73,
142
+ "percent": 1.71,
143
143
  "reduction": 24.2
144
144
  },
145
145
  {
@@ -154,7 +154,7 @@
154
154
  "/src/shared/index.ts",
155
155
  "/src/shared/hooks/createHooksInternal.tsx"
156
156
  ],
157
- "percent": 1.55,
157
+ "percent": 1.53,
158
158
  "reduction": 79.61
159
159
  },
160
160
  {
@@ -170,7 +170,7 @@
170
170
  "/src/shared/hooks/createHooksInternal.tsx",
171
171
  "/src/utils/createUtilityFunctions.ts"
172
172
  ],
173
- "percent": 1.05,
173
+ "percent": 1.04,
174
174
  "reduction": 17.31
175
175
  },
176
176
  {
@@ -216,7 +216,7 @@
216
216
  "dependents": [
217
217
  "/src/shared/index.ts"
218
218
  ],
219
- "percent": 0.29,
219
+ "percent": 0.28,
220
220
  "reduction": 74.9
221
221
  },
222
222
  {
@@ -230,26 +230,26 @@
230
230
  "reduction": 100
231
231
  },
232
232
  {
233
- "id": "/src/shared/index.ts",
233
+ "id": "/src/server/index.ts",
234
234
  "size": 0,
235
- "origSize": 706,
235
+ "origSize": 54,
236
236
  "renderedExports": [],
237
237
  "removedExports": [],
238
- "dependents": [
239
- "/src/createTRPCReact.tsx",
240
- "/src/createTRPCQueryUtils.tsx",
241
- "/src/server/ssgProxy.ts"
242
- ],
238
+ "dependents": [],
243
239
  "percent": 0,
244
240
  "reduction": 100
245
241
  },
246
242
  {
247
- "id": "/src/server/index.ts",
243
+ "id": "/src/shared/index.ts",
248
244
  "size": 0,
249
- "origSize": 54,
245
+ "origSize": 706,
250
246
  "renderedExports": [],
251
247
  "removedExports": [],
252
- "dependents": [],
248
+ "dependents": [
249
+ "/src/createTRPCReact.tsx",
250
+ "/src/createTRPCQueryUtils.tsx",
251
+ "/src/server/ssgProxy.ts"
252
+ ],
253
253
  "percent": 0,
254
254
  "reduction": 100
255
255
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ssgProxy.d.ts","sourceRoot":"","sources":["../../src/server/ssgProxy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,gBAAgB,EAChB,WAAW,EACZ,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAoB,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEnE,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EACV,iBAAiB,EACjB,YAAY,EACZ,SAAS,EACT,gBAAgB,EAChB,kBAAkB,EAElB,qBAAqB,EACrB,YAAY,EACb,MAAM,0CAA0C,CAAC;AAOlD,OAAO,KAAK,EACV,gCAAgC,EAChC,sBAAsB,EAGvB,MAAM,WAAW,CAAC;AAGnB,KAAK,wBAAwB,CAAC,OAAO,SAAS,SAAS,IAAI;IACzD,MAAM,EAAE,OAAO,CAAC;IAChB,GAAG,EAAE,kBAAkB,CAAC,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C,KAAK,GACT,KAAK;CACV,CAAC;AAIF;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,SAAS,SAAS,EAC/D,IAAI,EAAE,8BAA8B,CAAC,OAAO,CAAC;iBAsE5B,WAAW;eACb,CAAC,IAAI,CAAC,EAAE,gBAAgB,KAAK,eAAe;iGAsE5D"}
@@ -41,12 +41,27 @@ var queryClient = require('../shared/queryClient.js');
41
41
  };
42
42
  })();
43
43
  function _dehydrate(opts = {
44
- shouldDehydrateQuery () {
44
+ shouldDehydrateQuery (query) {
45
+ if (query.state.status === 'pending') {
46
+ return false;
47
+ }
45
48
  // makes sure to serialize errors
46
49
  return true;
47
50
  }
48
51
  }) {
49
- const before = reactQuery.dehydrate(queryClient$1, opts);
52
+ const before = unstableCoreDoNotImport.run(()=>{
53
+ const dehydrated = reactQuery.dehydrate(queryClient$1, opts);
54
+ return {
55
+ ...dehydrated,
56
+ queries: dehydrated.queries.map((query)=>{
57
+ if (query.promise) {
58
+ const { promise: _, ...rest } = query;
59
+ return rest;
60
+ }
61
+ return query;
62
+ })
63
+ };
64
+ });
50
65
  const after = resolvedOpts.serialize(before);
51
66
  return after;
52
67
  }
@@ -1,7 +1,7 @@
1
1
  import { dehydrate } from '@tanstack/react-query';
2
2
  import { TRPCUntypedClient, getUntypedClient } from '@trpc/client';
3
3
  import { getTransformer } from '@trpc/client/unstable-internals';
4
- import { callProcedure, createRecursiveProxy, createFlatProxy } from '@trpc/server/unstable-core-do-not-import';
4
+ import { callProcedure, createRecursiveProxy, createFlatProxy, run } from '@trpc/server/unstable-core-do-not-import';
5
5
  import { getQueryKeyInternal } from '../internals/getQueryKey.mjs';
6
6
  import { getQueryType } from '../shared/proxy/utilsProxy.mjs';
7
7
  import 'react';
@@ -39,12 +39,27 @@ import { getQueryClient } from '../shared/queryClient.mjs';
39
39
  };
40
40
  })();
41
41
  function _dehydrate(opts = {
42
- shouldDehydrateQuery () {
42
+ shouldDehydrateQuery (query) {
43
+ if (query.state.status === 'pending') {
44
+ return false;
45
+ }
43
46
  // makes sure to serialize errors
44
47
  return true;
45
48
  }
46
49
  }) {
47
- const before = dehydrate(queryClient, opts);
50
+ const before = run(()=>{
51
+ const dehydrated = dehydrate(queryClient, opts);
52
+ return {
53
+ ...dehydrated,
54
+ queries: dehydrated.queries.map((query)=>{
55
+ if (query.promise) {
56
+ const { promise: _, ...rest } = query;
57
+ return rest;
58
+ }
59
+ return query;
60
+ })
61
+ };
62
+ });
48
63
  const after = resolvedOpts.serialize(before);
49
64
  return after;
50
65
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trpc/react-query",
3
- "version": "11.0.0-rc.818+1becc23d9",
3
+ "version": "11.0.0-rc.819+b550ee46a",
4
4
  "description": "The tRPC React library",
5
5
  "author": "KATT",
6
6
  "license": "MIT",
@@ -67,8 +67,8 @@
67
67
  },
68
68
  "peerDependencies": {
69
69
  "@tanstack/react-query": "^5.62.8",
70
- "@trpc/client": "11.0.0-rc.818+1becc23d9",
71
- "@trpc/server": "11.0.0-rc.818+1becc23d9",
70
+ "@trpc/client": "11.0.0-rc.819+b550ee46a",
71
+ "@trpc/server": "11.0.0-rc.819+b550ee46a",
72
72
  "react": ">=18.2.0",
73
73
  "react-dom": ">=18.2.0",
74
74
  "typescript": ">=5.7.2"
@@ -81,8 +81,8 @@
81
81
  "@testing-library/jest-dom": "^6.0.0",
82
82
  "@testing-library/react": "^16.1.0",
83
83
  "@testing-library/user-event": "^14.4.3",
84
- "@trpc/client": "11.0.0-rc.818+1becc23d9",
85
- "@trpc/server": "11.0.0-rc.818+1becc23d9",
84
+ "@trpc/client": "11.0.0-rc.819+b550ee46a",
85
+ "@trpc/server": "11.0.0-rc.819+b550ee46a",
86
86
  "@types/express": "^5.0.0",
87
87
  "@types/node": "^22.13.5",
88
88
  "@types/react": "^19.0.0",
@@ -104,5 +104,5 @@
104
104
  "funding": [
105
105
  "https://trpc.io/sponsor"
106
106
  ],
107
- "gitHead": "1becc23d9f13c706c3279c356dedcc35071750a6"
107
+ "gitHead": "b550ee46a02e455b9dfed610c6d32fc75475748c"
108
108
  }
@@ -25,6 +25,7 @@ import {
25
25
  callProcedure,
26
26
  createFlatProxy,
27
27
  createRecursiveProxy,
28
+ run,
28
29
  } from '@trpc/server/unstable-core-do-not-import';
29
30
  import { getQueryKeyInternal } from '../internals/getQueryKey';
30
31
  import type {
@@ -120,13 +121,29 @@ export function createServerSideHelpers<TRouter extends AnyRouter>(
120
121
 
121
122
  function _dehydrate(
122
123
  opts: DehydrateOptions = {
123
- shouldDehydrateQuery() {
124
+ shouldDehydrateQuery(query) {
125
+ if (query.state.status === 'pending') {
126
+ return false;
127
+ }
124
128
  // makes sure to serialize errors
125
129
  return true;
126
130
  },
127
131
  },
128
132
  ): DehydratedState {
129
- const before = dehydrate(queryClient, opts);
133
+ const before = run(() => {
134
+ const dehydrated = dehydrate(queryClient, opts);
135
+
136
+ return {
137
+ ...dehydrated,
138
+ queries: dehydrated.queries.map((query) => {
139
+ if (query.promise) {
140
+ const { promise: _, ...rest } = query;
141
+ return rest;
142
+ }
143
+ return query;
144
+ }),
145
+ };
146
+ });
130
147
  const after = resolvedOpts.serialize(before);
131
148
  return after;
132
149
  }