Skip to content

Commit

Permalink
[Fizz] Always call flush() if it exists (#21625)
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon committed Jun 4, 2021
1 parent 4692699 commit cc4d24a
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions packages/react-server/src/ReactServerStreamConfigNode.js
Expand Up @@ -11,8 +11,6 @@ import type {Writable} from 'stream';

type MightBeFlushable = {
flush?: () => void,
// Legacy
flushHeaders?: () => void,
...
};

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

Expand Down

0 comments on commit cc4d24a

Please sign in to comment.