Skip to content

Commit

Permalink
fix (ai/rsc): "could not find InternalStreamableUIClient" bug (#2068)
Browse files Browse the repository at this point in the history
  • Loading branch information
lgrammel committed Jun 24, 2024
1 parent 2b2960f commit 74e2822
Show file tree
Hide file tree
Showing 24 changed files with 916 additions and 563 deletions.
5 changes: 5 additions & 0 deletions .changeset/smart-trainers-build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'ai': patch
---

fix (ai/rsc): "could not find InternalStreamableUIClient" bug
91 changes: 91 additions & 0 deletions packages/core/rsc/__snapshots__/streamable.ui.test.tsx.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`rsc - render() > should emit React Nodes with async render function 1`] = `
{
"children": {
"children": {},
"props": {
"c": undefined,
"n": {
"done": false,
"next": {
"done": true,
"value": <div>
Weather
</div>,
},
"value": <div>
Weather
</div>,
},
},
"type": "",
},
"props": {
"fallback": undefined,
},
"type": "Symbol(react.suspense)",
}
`;

exports[`rsc - render() > should emit React Nodes with generator render function 1`] = `
{
"children": {
"children": {},
"props": {
"c": undefined,
"n": {
"done": false,
"next": {
"done": false,
"next": {
"done": true,
"value": <div>
Weather
</div>,
},
"value": <div>
Weather
</div>,
},
"value": <div>
Loading...
</div>,
},
},
"type": "",
},
"props": {
"fallback": undefined,
},
"type": "Symbol(react.suspense)",
}
`;

exports[`rsc - render() > should emit React Nodes with sync render function 1`] = `
{
"children": {
"children": {},
"props": {
"c": undefined,
"n": {
"done": false,
"next": {
"done": true,
"value": <div>
Weather
</div>,
},
"value": <div>
Weather
</div>,
},
},
"type": "",
},
"props": {
"fallback": undefined,
},
"type": "Symbol(react.suspense)",
}
`;
1 change: 0 additions & 1 deletion packages/core/rsc/rsc-shared.mts
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@ export {
useActions,
useSyncUIState,
InternalAIProvider,
InternalStreamableUIClient,
} from './shared-client';
56 changes: 0 additions & 56 deletions packages/core/rsc/shared-client/client-wrapper.tsx

This file was deleted.

1 change: 0 additions & 1 deletion packages/core/rsc/shared-client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ export {
useSyncUIState,
InternalAIProvider,
} from './context';
export { InternalStreamableUIClient } from './client-wrapper';
15 changes: 1 addition & 14 deletions packages/core/rsc/shared-client/streamable.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
import {
ReactElement,
startTransition,
useLayoutEffect,
useState,
} from 'react';
import { startTransition, useLayoutEffect, useState } from 'react';
import { STREAMABLE_VALUE_TYPE } from '../constants';
import type { StreamableValue } from '../types';

Expand Down Expand Up @@ -102,14 +97,6 @@ export function readStreamableValue<T = unknown>(
(curr as string) = curr + row.diff[1];
}
break;
case 1:
(curr as ReactElement) = (
<>
{curr}
{row.diff[1]}
</>
);
break;
}
} else {
curr = row.curr;
Expand Down
Loading

0 comments on commit 74e2822

Please sign in to comment.