Skip to content

Commit 3bf2574

Browse files
committed
flow assertions
1 parent b2f9538 commit 3bf2574

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

packages/react-server/src/ReactFizzServer.js

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2074,12 +2074,16 @@ function flushCompletedQueues(
20742074
const completedRootSegment = request.completedRootSegment;
20752075
if (completedRootSegment !== null) {
20762076
if (request.pendingRootTasks === 0) {
2077-
const preamble = request.preamble;
2078-
for (i = 0; i < preamble.length; i++) {
2079-
// we expect the preamble to be tiny and will ignore backpressure
2080-
writeChunk(destination, preamble[i]);
2077+
if (enableFloat) {
2078+
const preamble: Array<
2079+
Chunk | PrecomputedChunk,
2080+
> = (request.preamble: any);
2081+
for (i = 0; i < preamble.length; i++) {
2082+
// we expect the preamble to be tiny and will ignore backpressure
2083+
writeChunk(destination, preamble[i]);
2084+
}
2085+
preamble.length = 0;
20812086
}
2082-
preamble.length = 0;
20832087

20842088
flushSegment(request, destination, completedRootSegment);
20852089
request.completedRootSegment = null;
@@ -2165,11 +2169,15 @@ function flushCompletedQueues(
21652169
// either they have pending task or they're complete.
21662170
) {
21672171
allComplete = true;
2168-
const postamble = request.postamble;
2169-
for (i = 0; i < postamble.length; i++) {
2170-
writeChunk(destination, postamble[i]);
2172+
if (enableFloat) {
2173+
const postamble: Array<
2174+
Chunk | PrecomputedChunk,
2175+
> = (request.postamble: any);
2176+
for (i = 0; i < postamble.length; i++) {
2177+
writeChunk(destination, postamble[i]);
2178+
}
2179+
postamble.length = 0;
21712180
}
2172-
postamble.length = 0;
21732181
}
21742182
} finally {
21752183
completeWriting(destination);

0 commit comments

Comments
 (0)