[Fizz] Always call flush() if it exists (#21625)
Dan Abramov committed
Jun 4, 2021 at 20:17 UTC
cc4d24ab0b1b70c6d30e1131e496c59ff9f85d5f
1 file changed
+3
-8
packages/react-server/src/ReactServerStreamConfigNode.js
+3
-8
@@ -11,8 +11,6 @@ import type {Writable} from 'stream';
11
12
type MightBeFlushable = {
13
flush?: () => void,
14
- // Legacy
15
- flushHeaders?: () => void,
14
...
15
};
16
@@ -31,12 +29,9 @@ export function flushBuffered(destination: Destination) {
29
// If we don't have any more data to send right now.
30
// Flush whatever is in the buffer to the wire.
31
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();
35
}
36
}
37