Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fizz] Always call flush() if it exists #21625

Merged
merged 1 commit into from
Jun 4, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions packages/react-server/src/ReactServerStreamConfigNode.js
Original file line number Diff line number Diff line change
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