Skip to content

Commit

Permalink
Hack to filter extra comments for testing purposes
Browse files Browse the repository at this point in the history
  • Loading branch information
sebmarkbage committed Apr 15, 2021
1 parent f2b8db0 commit 001f830
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/react-dom/src/server/ReactDOMLegacyServerStreamConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 001f830

Please sign in to comment.