Skip to content

Commit e5635b9

Browse files
Reset render state after processing each chunk to prevent error carryover in stream rendering.
1 parent 468b0e6 commit e5635b9

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

node_package/src/streamServerRenderedReactComponent.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,12 @@ export const transformRenderStreamChunksToResultObject = (renderState: StreamRen
105105
const jsonChunk = JSON.stringify(createResultObject(htmlChunk, '', renderState));
106106
this.push(`${jsonChunk}\n`);
107107

108+
// Reset the render state to ensure that the error is not carried over to the next chunk
109+
// eslint-disable-next-line no-param-reassign
110+
renderState.error = undefined;
111+
// eslint-disable-next-line no-param-reassign
112+
renderState.hasErrors = false;
113+
108114
clearTimeout(consoleReplayTimeoutId);
109115
consoleReplayTimeoutId = setTimeout(() => {
110116
const consoleReplayChunk = buildConsoleReplayChunk();

0 commit comments

Comments
 (0)