diff --git a/packages/react-server-dom-fb/src/ReactDOMServerFB.js b/packages/react-server-dom-fb/src/ReactDOMServerFB.js index bdf4dcedaee0b..96c8a1c9065fa 100644 --- a/packages/react-server-dom-fb/src/ReactDOMServerFB.js +++ b/packages/react-server-dom-fb/src/ReactDOMServerFB.js @@ -79,8 +79,8 @@ function renderToStream(children: ReactNodeList, options: Options): Stream { }; } -function abortStream(stream: Stream): void { - abort(stream.request); +function abortStream(stream: Stream, reason: mixed): void { + abort(stream.request, reason); } function renderNextChunk(stream: Stream): string { diff --git a/packages/react-server-dom-fb/src/__tests__/ReactDOMServerFB-test.internal.js b/packages/react-server-dom-fb/src/__tests__/ReactDOMServerFB-test.internal.js index 8e6ff121cc952..7b3460066405b 100644 --- a/packages/react-server-dom-fb/src/__tests__/ReactDOMServerFB-test.internal.js +++ b/packages/react-server-dom-fb/src/__tests__/ReactDOMServerFB-test.internal.js @@ -195,4 +195,22 @@ describe('ReactDOMServerFB', () => { 'The render was aborted by the server without a reason.', ]); }); + + it('should allow setting an abort reason', () => { + const errors = []; + const stream = ReactDOMServer.renderToStream( +