@trpc/react-query 11.0.0-alpha-tmp-app-router-example.382 → 11.0.0-alpha-tmp-app-router-example.384

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": 32132,
3
- "bundleOrigSize": 68297,
4
- "bundleReduction": 52.95,
2
+ "bundleSize": 32207,
3
+ "bundleOrigSize": 68385,
4
+ "bundleReduction": 52.9,
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": 42.77,
17
+ "percent": 42.67,
18
18
  "reduction": 12.84
19
19
  },
20
20
  {
@@ -29,7 +29,7 @@
29
29
  "/src/createTRPCQueryUtils.tsx",
30
30
  "/src/shared/hooks/createHooksInternal.tsx"
31
31
  ],
32
- "percent": 11.77,
32
+ "percent": 11.74,
33
33
  "reduction": 6.34
34
34
  },
35
35
  {
@@ -43,7 +43,7 @@
43
43
  "dependents": [
44
44
  "/src/server/index.ts"
45
45
  ],
46
- "percent": 11.43,
46
+ "percent": 11.4,
47
47
  "reduction": 50.38
48
48
  },
49
49
  {
@@ -59,20 +59,20 @@
59
59
  "dependents": [
60
60
  "/src/shared/index.ts"
61
61
  ],
62
- "percent": 8.93,
62
+ "percent": 8.91,
63
63
  "reduction": 74.38
64
64
  },
65
65
  {
66
66
  "id": "/src/rsc.tsx",
67
- "size": 2701,
68
- "origSize": 4857,
67
+ "size": 2776,
68
+ "origSize": 4945,
69
69
  "renderedExports": [
70
70
  "createHydrationHelpers"
71
71
  ],
72
72
  "removedExports": [],
73
73
  "dependents": [],
74
- "percent": 8.41,
75
- "reduction": 44.39
74
+ "percent": 8.62,
75
+ "reduction": 43.86
76
76
  },
77
77
  {
78
78
  "id": "/src/internals/getQueryKey.ts",
@@ -91,7 +91,7 @@
91
91
  "/src/shared/proxy/useQueriesProxy.ts",
92
92
  "/src/shared/hooks/createHooksInternal.tsx"
93
93
  ],
94
- "percent": 6.22,
94
+ "percent": 6.21,
95
95
  "reduction": 42.49
96
96
  },
97
97
  {
@@ -106,7 +106,7 @@
106
106
  "dependents": [
107
107
  "/src/index.ts"
108
108
  ],
109
- "percent": 2.65,
109
+ "percent": 2.64,
110
110
  "reduction": 89.28
111
111
  },
112
112
  {
@@ -120,7 +120,7 @@
120
120
  "dependents": [
121
121
  "/src/shared/index.ts"
122
122
  ],
123
- "percent": 2.51,
123
+ "percent": 2.5,
124
124
  "reduction": 23.16
125
125
  },
126
126
  {
package/dist/rsc.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"rsc.d.ts","sourceRoot":"","sources":["../src/rsc.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,WAAW,EACjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAEL,KAAK,SAAS,EACd,KAAK,mBAAmB,EACxB,KAAK,YAAY,EAClB,MAAM,0CAA0C,CAAC;AAClD,OAAO,KAAK,EACV,YAAY,EACZ,YAAY,EACZ,oBAAoB,EACpB,oBAAoB,EAEpB,YAAY,EACZ,SAAS,EACV,MAAM,0CAA0C,CAAC;AAClD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EACV,6BAA6B,EAC7B,qBAAqB,EACtB,MAAM,UAAU,CAAC;AAIlB,KAAK,iBAAiB,CACpB,KAAK,SAAS,YAAY,EAC1B,UAAU,SAAS,YAAY,IAC7B;IACF,CAAC,KAAK,EAAE,mBAAmB,CAAC,UAAU,CAAC,GAAG,OAAO,CAC/C,oBAAoB,CAAC,UAAU,CAAC,CACjC,CAAC;IACF,QAAQ,EAAE,CACR,KAAK,EAAE,mBAAmB,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AAEF,KAAK,oBAAoB,CACvB,KAAK,SAAS,YAAY,EAC1B,OAAO,SAAS,YAAY,IAC1B;KACD,IAAI,IAAI,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,SAAS,YAAY,GACvD,iBAAiB,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,GACvC,OAAO,CAAC,IAAI,CAAC,SAAS,YAAY,GAClC,oBAAoB,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,GAC1C,KAAK;CACV,CAAC;AAEF,KAAK,MAAM,CAAC,OAAO,SAAS,SAAS,IAAI,UAAU,CACjD,YAAY,CAAC,oBAAoB,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,CACvE,CAAC;AAGF,wBAAgB,sBAAsB,CAAC,OAAO,SAAS,SAAS,EAC9D,MAAM,EAAE,SAAS,SAAS,OAAO,GAC7B,SAAS,CAAC,6DAA6D,CAAC,GACxE,MAAM,CAAC,OAAO,CAAC,EACnB,cAAc,EAAE,MAAM,WAAW;IA2D/B;;;;;;;;;;;OAWG;;IAEH;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;2BAhDyB;QAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;KAAE;EAmD5D"}
package/dist/rsc.js CHANGED
@@ -35,13 +35,18 @@ function createHydrationHelpers(caller, getQueryClient) {
35
35
  HELPERS.includes(key) ? acc : acc[key], caller);
36
36
  const input = args[0];
37
37
  const promise = proc(input);
38
+ const queryFn = async ()=>{
39
+ const def = await caller._def();
40
+ const transformer = def._config.transformer;
41
+ return promise.then((value)=>transformer.output.serialize(value));
42
+ };
38
43
  const helper = path.pop();
39
44
  if (helper === 'prefetch') {
40
45
  const args1 = args[1];
41
46
  return getQueryClient().prefetchQuery({
42
47
  ...args1,
43
48
  queryKey: getQueryKey.getQueryKeyInternal(path, input, 'query'),
44
- queryFn: ()=>promise
49
+ queryFn
45
50
  });
46
51
  }
47
52
  if (helper === 'prefetchInfinite') {
@@ -49,7 +54,7 @@ function createHydrationHelpers(caller, getQueryClient) {
49
54
  return getQueryClient().prefetchInfiniteQuery({
50
55
  ...args11,
51
56
  queryKey: getQueryKey.getQueryKeyInternal(path, input, 'infinite'),
52
- queryFn: ()=>promise,
57
+ queryFn,
53
58
  initialPageParam: args11?.initialCursor ?? null
54
59
  });
55
60
  }
@@ -57,8 +62,6 @@ function createHydrationHelpers(caller, getQueryClient) {
57
62
  });
58
63
  function HydrateClient(props) {
59
64
  const dehydratedState = reactQuery.dehydrate(getQueryClient());
60
- // TODO: transform?? We can't transform promises i don't think...
61
- // since that is handled by React internally
62
65
  return /*#__PURE__*/ React__namespace.createElement(reactQuery.HydrationBoundary, {
63
66
  state: dehydratedState
64
67
  }, props.children);
package/dist/rsc.mjs CHANGED
@@ -14,13 +14,18 @@ function createHydrationHelpers(caller, getQueryClient) {
14
14
  HELPERS.includes(key) ? acc : acc[key], caller);
15
15
  const input = args[0];
16
16
  const promise = proc(input);
17
+ const queryFn = async ()=>{
18
+ const def = await caller._def();
19
+ const transformer = def._config.transformer;
20
+ return promise.then((value)=>transformer.output.serialize(value));
21
+ };
17
22
  const helper = path.pop();
18
23
  if (helper === 'prefetch') {
19
24
  const args1 = args[1];
20
25
  return getQueryClient().prefetchQuery({
21
26
  ...args1,
22
27
  queryKey: getQueryKeyInternal(path, input, 'query'),
23
- queryFn: ()=>promise
28
+ queryFn
24
29
  });
25
30
  }
26
31
  if (helper === 'prefetchInfinite') {
@@ -28,7 +33,7 @@ function createHydrationHelpers(caller, getQueryClient) {
28
33
  return getQueryClient().prefetchInfiniteQuery({
29
34
  ...args11,
30
35
  queryKey: getQueryKeyInternal(path, input, 'infinite'),
31
- queryFn: ()=>promise,
36
+ queryFn,
32
37
  initialPageParam: args11?.initialCursor ?? null
33
38
  });
34
39
  }
@@ -36,8 +41,6 @@ function createHydrationHelpers(caller, getQueryClient) {
36
41
  });
37
42
  function HydrateClient(props) {
38
43
  const dehydratedState = dehydrate(getQueryClient());
39
- // TODO: transform?? We can't transform promises i don't think...
40
- // since that is handled by React internally
41
44
  return /*#__PURE__*/ React.createElement(HydrationBoundary, {
42
45
  state: dehydratedState
43
46
  }, props.children);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trpc/react-query",
3
- "version": "11.0.0-alpha-tmp-app-router-example.382+c359a47e9",
3
+ "version": "11.0.0-alpha-tmp-app-router-example.384+28243c34d",
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": "^5.25.0",
67
- "@trpc/client": "11.0.0-alpha-tmp-app-router-example.382+c359a47e9",
68
- "@trpc/server": "11.0.0-alpha-tmp-app-router-example.382+c359a47e9",
67
+ "@trpc/client": "11.0.0-alpha-tmp-app-router-example.384+28243c34d",
68
+ "@trpc/server": "11.0.0-alpha-tmp-app-router-example.384+28243c34d",
69
69
  "react": ">=18.2.0",
70
70
  "react-dom": ">=18.2.0"
71
71
  },
72
72
  "devDependencies": {
73
73
  "@tanstack/react-query": "^5.40.0",
74
- "@trpc/client": "11.0.0-alpha-tmp-app-router-example.382+c359a47e9",
75
- "@trpc/server": "11.0.0-alpha-tmp-app-router-example.382+c359a47e9",
74
+ "@trpc/client": "11.0.0-alpha-tmp-app-router-example.384+28243c34d",
75
+ "@trpc/server": "11.0.0-alpha-tmp-app-router-example.384+28243c34d",
76
76
  "@types/express": "^4.17.17",
77
77
  "@types/node": "^20.10.0",
78
78
  "@types/react": "^18.3.1",
@@ -92,5 +92,5 @@
92
92
  "funding": [
93
93
  "https://trpc.io/sponsor"
94
94
  ],
95
- "gitHead": "c359a47e9da8bc4c8d177189e3738fe440d87ddd"
95
+ "gitHead": "28243c34dd1f4145ef6e9d350bf2cab8e5139ac8"
96
96
  }
package/src/rsc.tsx CHANGED
@@ -87,25 +87,33 @@ export function createHydrationHelpers<TRouter extends AnyRouter>(
87
87
  const input = args[0];
88
88
  const promise = proc(input);
89
89
 
90
+ const queryFn = async () => {
91
+ const def: AnyRouter['_def'] = await (caller as any)._def();
92
+ const transformer = def._config.transformer;
93
+ return promise.then((value) => transformer.output.serialize(value));
94
+ };
95
+
90
96
  const helper = path.pop();
91
97
  if (helper === 'prefetch') {
92
98
  const args1 = args[1] as Maybe<
93
99
  TRPCFetchInfiniteQueryOptions<any, any, any>
94
100
  >;
101
+
95
102
  return getQueryClient().prefetchQuery({
96
103
  ...args1,
97
104
  queryKey: getQueryKeyInternal(path, input, 'query'),
98
- queryFn: () => promise,
105
+ queryFn,
99
106
  });
100
107
  }
101
108
  if (helper === 'prefetchInfinite') {
102
109
  const args1 = args[1] as Maybe<
103
110
  TRPCFetchInfiniteQueryOptions<any, any, any>
104
111
  >;
112
+
105
113
  return getQueryClient().prefetchInfiniteQuery({
106
114
  ...args1,
107
115
  queryKey: getQueryKeyInternal(path, input, 'infinite'),
108
- queryFn: () => promise,
116
+ queryFn,
109
117
  initialPageParam: args1?.initialCursor ?? null,
110
118
  });
111
119
  }
@@ -115,8 +123,6 @@ export function createHydrationHelpers<TRouter extends AnyRouter>(
115
123
 
116
124
  function HydrateClient(props: { children: React.ReactNode }) {
117
125
  const dehydratedState = dehydrate(getQueryClient());
118
- // TODO: transform?? We can't transform promises i don't think...
119
- // since that is handled by React internally
120
126
 
121
127
  return (
122
128
  <HydrationBoundary state={dehydratedState}>