From e3ae8db408025095c59de8c703e1944c71480fdb Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Fri, 4 Jun 2021 20:02:40 +0100 Subject: [PATCH] [Fizz] Always call flush() if it exists --- .../react-server/src/ReactServerStreamConfigNode.js | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/packages/react-server/src/ReactServerStreamConfigNode.js b/packages/react-server/src/ReactServerStreamConfigNode.js index c44d5b8ee6566..58ce127ba9659 100644 --- a/packages/react-server/src/ReactServerStreamConfigNode.js +++ b/packages/react-server/src/ReactServerStreamConfigNode.js @@ -11,8 +11,6 @@ import type {Writable} from 'stream'; type MightBeFlushable = { flush?: () => void, - // Legacy - flushHeaders?: () => void, ... }; @@ -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(); } }