Skip to content

Commit 404e036

Browse files
committed
Rename startWriting to pipe
This mirrors the ReadableStream API in Node
1 parent 21db19f commit 404e036

File tree

8 files changed

+106
-114
lines changed

8 files changed

+106
-114
lines changed

fixtures/flight/server/handler.server.js

+2-5
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,8 @@ module.exports = function(req, res) {
2020
const App = m.default.default || m.default;
2121
res.setHeader('Access-Control-Allow-Origin', '*');
2222
const moduleMap = JSON.parse(data);
23-
const {startWriting} = renderToNodePipe(
24-
React.createElement(App),
25-
moduleMap
26-
);
27-
startWriting(res);
23+
const {pipe} = renderToNodePipe(React.createElement(App), moduleMap);
24+
pipe(res);
2825
}
2926
);
3027
});

fixtures/ssr/server/render.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ export default function render(url, res) {
2020
console.error('Fatal', error);
2121
});
2222
let didError = false;
23-
const {startWriting, abort} = renderToNodePipe(<App assets={assets} />, {
23+
const {pipe, abort} = renderToNodePipe(<App assets={assets} />, {
2424
onCompleteShell() {
2525
// If something errored before we started streaming, we set the error code appropriately.
2626
res.statusCode = didError ? 500 : 200;
2727
res.setHeader('Content-type', 'text/html');
28-
startWriting(res);
28+
pipe(res);
2929
},
3030
onError(x) {
3131
didError = true;

fixtures/ssr2/server/render.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ module.exports = function render(url, res) {
3737
});
3838
let didError = false;
3939
const data = createServerData();
40-
const {startWriting, abort} = renderToNodePipe(
40+
const {pipe, abort} = renderToNodePipe(
4141
<DataProvider data={data}>
4242
<App assets={assets} />
4343
</DataProvider>,
@@ -46,7 +46,7 @@ module.exports = function render(url, res) {
4646
// If something errored before we started streaming, we set the error code appropriately.
4747
res.statusCode = didError ? 500 : 200;
4848
res.setHeader('Content-type', 'text/html');
49-
startWriting(res);
49+
pipe(res);
5050
},
5151
onError(x) {
5252
didError = true;

0 commit comments

Comments
 (0)