Skip to content

Commit

Permalink
Failing test for deduped props of elements in fragments
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon committed Jul 30, 2024
1 parent bea5a2b commit e26781e
Showing 1 changed file with 47 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,53 @@ describe('ReactFlightDOMBrowser', () => {
expect(container.innerHTML).toBe('{"foo":1}{"foo":1}');
});

it('should handle deduped props of elements in fragments', async () => {
let resolveFooClientComponentChunk;

const FooClient = clientExports(
function Foo({children, item}) {
return children;
},
'1',
'/foo.js',
new Promise(resolve => (resolveFooClientComponentChunk = resolve)),
);

const shared = <div />;

function Server() {
return (
<FooClient track={shared}>
<React.Fragment>{shared}</React.Fragment>
</FooClient>
);
}

const stream = await serverAct(() =>
ReactServerDOMServer.renderToReadableStream(<Server />, webpackMap),
);

function ClientRoot({response}) {
return use(response);
}

const response = ReactServerDOMClient.createFromReadableStream(stream);
const container = document.createElement('div');
const root = ReactDOMClient.createRoot(container);

await act(() => {
root.render(<ClientRoot response={response} />);
});

expect(container.innerHTML).toBe('');

await act(() => {
resolveFooClientComponentChunk();
});

expect(container.innerHTML).toBe('<div></div>');
});

it('should progressively reveal server components', async () => {
let reportedErrors = [];

Expand Down

0 comments on commit e26781e

Please sign in to comment.