GeezerVison is showing github.com — [Fizz] Always call flush() if it exists (#21625) · react/react@cc4d24a
File tree
Expand file treeCollapse file tree
Open diff view settings
packages/react-server/src
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: packages/react-server/src/ReactServerStreamConfigNode.js +3-8Lines changed: 3 additions & 8 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -11,8 +11,6 @@ import type {Writable} from 'stream'; |
11 | 11 |
|
12 | 12 | type MightBeFlushable = { |
13 | 13 | flush?: () => void, |
14 | | - // Legacy |
15 | | - flushHeaders?: () => void, |
16 | 14 | ... |
17 | 15 | }; |
18 | 16 |
|
@@ -31,12 +29,9 @@ export function flushBuffered(destination: Destination) { |
31 | 29 | // If we don't have any more data to send right now. |
32 | 30 | // Flush whatever is in the buffer to the wire. |
33 | 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(); |
40 | 35 | } |
41 | 36 | } |
42 | 37 |
|
|