Skip to content

Commit 74e2822

Browse files
authoredJun 24, 2024··
fix (ai/rsc): "could not find InternalStreamableUIClient" bug (#2068)
1 parent 2b2960f commit 74e2822

24 files changed

+916
-563
lines changed
 

‎.changeset/smart-trainers-build.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'ai': patch
3+
---
4+
5+
fix (ai/rsc): "could not find InternalStreamableUIClient" bug
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2+
3+
exports[`rsc - render() > should emit React Nodes with async render function 1`] = `
4+
{
5+
"children": {
6+
"children": {},
7+
"props": {
8+
"c": undefined,
9+
"n": {
10+
"done": false,
11+
"next": {
12+
"done": true,
13+
"value": <div>
14+
Weather
15+
</div>,
16+
},
17+
"value": <div>
18+
Weather
19+
</div>,
20+
},
21+
},
22+
"type": "",
23+
},
24+
"props": {
25+
"fallback": undefined,
26+
},
27+
"type": "Symbol(react.suspense)",
28+
}
29+
`;
30+
31+
exports[`rsc - render() > should emit React Nodes with generator render function 1`] = `
32+
{
33+
"children": {
34+
"children": {},
35+
"props": {
36+
"c": undefined,
37+
"n": {
38+
"done": false,
39+
"next": {
40+
"done": false,
41+
"next": {
42+
"done": true,
43+
"value": <div>
44+
Weather
45+
</div>,
46+
},
47+
"value": <div>
48+
Weather
49+
</div>,
50+
},
51+
"value": <div>
52+
Loading...
53+
</div>,
54+
},
55+
},
56+
"type": "",
57+
},
58+
"props": {
59+
"fallback": undefined,
60+
},
61+
"type": "Symbol(react.suspense)",
62+
}
63+
`;
64+
65+
exports[`rsc - render() > should emit React Nodes with sync render function 1`] = `
66+
{
67+
"children": {
68+
"children": {},
69+
"props": {
70+
"c": undefined,
71+
"n": {
72+
"done": false,
73+
"next": {
74+
"done": true,
75+
"value": <div>
76+
Weather
77+
</div>,
78+
},
79+
"value": <div>
80+
Weather
81+
</div>,
82+
},
83+
},
84+
"type": "",
85+
},
86+
"props": {
87+
"fallback": undefined,
88+
},
89+
"type": "Symbol(react.suspense)",
90+
}
91+
`;

‎packages/core/rsc/rsc-shared.mts

-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,4 @@ export {
88
useActions,
99
useSyncUIState,
1010
InternalAIProvider,
11-
InternalStreamableUIClient,
1211
} from './shared-client';

‎packages/core/rsc/shared-client/client-wrapper.tsx

-56
This file was deleted.

‎packages/core/rsc/shared-client/index.ts

-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,3 @@ export {
88
useSyncUIState,
99
InternalAIProvider,
1010
} from './context';
11-
export { InternalStreamableUIClient } from './client-wrapper';

‎packages/core/rsc/shared-client/streamable.tsx

+1-14
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
import {
2-
ReactElement,
3-
startTransition,
4-
useLayoutEffect,
5-
useState,
6-
} from 'react';
1+
import { startTransition, useLayoutEffect, useState } from 'react';
72
import { STREAMABLE_VALUE_TYPE } from '../constants';
83
import type { StreamableValue } from '../types';
94

@@ -102,14 +97,6 @@ export function readStreamableValue<T = unknown>(
10297
(curr as string) = curr + row.diff[1];
10398
}
10499
break;
105-
case 1:
106-
(curr as ReactElement) = (
107-
<>
108-
{curr}
109-
{row.diff[1]}
110-
</>
111-
);
112-
break;
113100
}
114101
} else {
115102
curr = row.curr;

0 commit comments

Comments
 (0)
Please sign in to comment.