diff --git a/packages/react-server-dom-webpack/src/__tests__/ReactFlightDOMBrowser-test.js b/packages/react-server-dom-webpack/src/__tests__/ReactFlightDOMBrowser-test.js index 90393e435e91f..49f2823c8b387 100644 --- a/packages/react-server-dom-webpack/src/__tests__/ReactFlightDOMBrowser-test.js +++ b/packages/react-server-dom-webpack/src/__tests__/ReactFlightDOMBrowser-test.js @@ -392,6 +392,70 @@ describe('ReactFlightDOMBrowser', () => { expect(container.innerHTML).toBe('
1234512345
'); }); + it('should resolve deduped objects in nested children of blocked models', async () => { + let resolveOuterClientComponentChunk; + let resolveInnerClientComponentChunk; + + const ClientOuter = clientExports( + function ClientOuter({children, value}) { + return children; + }, + '1', + '/outer.js', + new Promise(resolve => (resolveOuterClientComponentChunk = resolve)), + ); + + function PassthroughServerComponent({children}) { + return children; + } + + const ClientInner = clientExports( + function ClientInner({children}) { + return JSON.stringify(children); + }, + '2', + '/inner.js', + new Promise(resolve => (resolveInnerClientComponentChunk = resolve)), + ); + + const value = {}; + + function Server() { + return ( + + + {value} + + + ); + } + + const stream = await serverAct(() => + ReactServerDOMServer.renderToReadableStream(, 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(); + }); + + expect(container.innerHTML).toBe(''); + + await act(() => { + resolveInnerClientComponentChunk(); + resolveOuterClientComponentChunk(); + }); + + expect(container.innerHTML).toBe('{}'); + }); + it('should progressively reveal server components', async () => { let reportedErrors = [];