Skip to content

Commit cc4d24a

Browse files
authored
[Fizz] Always call flush() if it exists (#21625)
1 parent 4692699 commit cc4d24a

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

packages/react-server/src/ReactServerStreamConfigNode.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ import type {Writable} from 'stream';
1111

1212
type MightBeFlushable = {
1313
flush?: () => void,
14-
// Legacy
15-
flushHeaders?: () => void,
1614
...
1715
};
1816

@@ -31,12 +29,9 @@ export function flushBuffered(destination: Destination) {
3129
// If we don't have any more data to send right now.
3230
// Flush whatever is in the buffer to the wire.
3331
if (typeof destination.flush === 'function') {
34-
// http.createServer response have flush(), but it has a different meaning and
35-
// is deprecated in favor of flushHeaders(). Detect to avoid a warning.
36-
if (typeof destination.flushHeaders !== 'function') {
37-
// By convention the Zlib streams provide a flush function for this purpose.
38-
destination.flush();
39-
}
32+
// By convention the Zlib streams provide a flush function for this purpose.
33+
// For Express, compression middleware adds this method.
34+
destination.flush();
4035
}
4136
}
4237

0 commit comments

Comments
 (0)