Skip to content

Commit 001f830

Browse files
committed
Hack to filter extra comments for testing purposes
1 parent f2b8db0 commit 001f830

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

packages/react-dom/src/server/ReactDOMLegacyServerStreamConfig.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,21 @@ export function flushBuffered(destination: Destination) {}
2424

2525
export function beginWriting(destination: Destination) {}
2626

27+
let prevWasCommentSegmenter = false;
2728
export function writeChunk(
2829
destination: Destination,
2930
chunk: Chunk | PrecomputedChunk,
3031
): boolean {
32+
if (prevWasCommentSegmenter) {
33+
prevWasCommentSegmenter = false;
34+
if (chunk[0] !== '<') {
35+
destination.push('<!-- -->');
36+
}
37+
}
38+
if (chunk === '<!-- -->') {
39+
prevWasCommentSegmenter = true;
40+
return true;
41+
}
3142
return destination.push(chunk);
3243
}
3344

0 commit comments

Comments
 (0)