GeezerVison is showing github.com — Remove hacky stream.locked check, declare as byte stream instead (#23… · react/react@75662d6
File tree
Expand file treeCollapse file tree
Open diff view settings
react-server-dom-webpack/src
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: packages/react-dom/src/server/ReactDOMFizzServerBrowser.js +2-7Lines changed: 2 additions & 7 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -43,14 +43,9 @@ function renderToReadableStream( |
43 | 43 | return new Promise((resolve, reject) => { |
44 | 44 | function onCompleteShell() { |
45 | 45 | const stream = new ReadableStream({ |
| 46 | + type: 'bytes', |
46 | 47 | pull(controller) { |
47 | | - // Pull is called immediately even if the stream is not passed to anything. |
48 | | - // That's buffering too early. We want to start buffering once the stream |
49 | | - // is actually used by something so we can give it the best result possible |
50 | | - // at that point. |
51 | | - if (stream.locked) { |
52 | | - startFlowing(request, controller); |
53 | | - } |
| 48 | + startFlowing(request, controller); |
54 | 49 | }, |
55 | 50 | cancel(reason) {}, |
56 | 51 | }); |
|
Collapse file
Copy file name to clipboardExpand all lines: packages/react-server-dom-webpack/src/ReactFlightDOMServerBrowser.js +2-7Lines changed: 2 additions & 7 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -31,17 +31,12 @@ function renderToReadableStream( |
31 | 31 | options ? options.onError : undefined, |
32 | 32 | ); |
33 | 33 | const stream = new ReadableStream({ |
| 34 | + type: 'bytes', |
34 | 35 | start(controller) { |
35 | 36 | startWork(request); |
36 | 37 | }, |
37 | 38 | pull(controller) { |
38 | | - // Pull is called immediately even if the stream is not passed to anything. |
39 | | - // That's buffering too early. We want to start buffering once the stream |
40 | | - // is actually used by something so we can give it the best result possible |
41 | | - // at that point. |
42 | | - if (stream.locked) { |
43 | | - startFlowing(request, controller); |
44 | | - } |
| 39 | + startFlowing(request, controller); |
45 | 40 | }, |
46 | 41 | cancel(reason) {}, |
47 | 42 | }); |
|