From 001f8303c51f8a1d7678618e09c29fb02d2230a6 Mon Sep 17 00:00:00 2001 From: Sebastian Markbage Date: Wed, 14 Apr 2021 22:01:55 -0400 Subject: [PATCH] Hack to filter extra comments for testing purposes --- .../src/server/ReactDOMLegacyServerStreamConfig.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/react-dom/src/server/ReactDOMLegacyServerStreamConfig.js b/packages/react-dom/src/server/ReactDOMLegacyServerStreamConfig.js index d32808f2bcec4..4cfe16091bc58 100644 --- a/packages/react-dom/src/server/ReactDOMLegacyServerStreamConfig.js +++ b/packages/react-dom/src/server/ReactDOMLegacyServerStreamConfig.js @@ -24,10 +24,21 @@ export function flushBuffered(destination: Destination) {} export function beginWriting(destination: Destination) {} +let prevWasCommentSegmenter = false; export function writeChunk( destination: Destination, chunk: Chunk | PrecomputedChunk, ): boolean { + if (prevWasCommentSegmenter) { + prevWasCommentSegmenter = false; + if (chunk[0] !== '<') { + destination.push(''); + } + } + if (chunk === '') { + prevWasCommentSegmenter = true; + return true; + } return destination.push(chunk); }