Skip to content

Commit

Permalink
Rename startWriting to pipe
Browse files Browse the repository at this point in the history
This mirrors the ReadableStream API in Node
  • Loading branch information
sebmarkbage committed Sep 28, 2021
1 parent 8f475a4 commit 2af324a
Show file tree
Hide file tree
Showing 8 changed files with 106 additions and 114 deletions.
7 changes: 2 additions & 5 deletions fixtures/flight/server/handler.server.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,8 @@ module.exports = function(req, res) {
const App = m.default.default || m.default;
res.setHeader('Access-Control-Allow-Origin', '*');
const moduleMap = JSON.parse(data);
const {startWriting} = renderToNodePipe(
React.createElement(App),
moduleMap
);
startWriting(res);
const {pipe} = renderToNodePipe(React.createElement(App), moduleMap);
pipe(res);
}
);
});
Expand Down
4 changes: 2 additions & 2 deletions fixtures/ssr/server/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ export default function render(url, res) {
console.error('Fatal', error);
});
let didError = false;
const {startWriting, abort} = renderToNodePipe(<App assets={assets} />, {
const {pipe, abort} = renderToNodePipe(<App assets={assets} />, {
onCompleteShell() {
// If something errored before we started streaming, we set the error code appropriately.
res.statusCode = didError ? 500 : 200;
res.setHeader('Content-type', 'text/html');
startWriting(res);
pipe(res);
},
onError(x) {
didError = true;
Expand Down
4 changes: 2 additions & 2 deletions fixtures/ssr2/server/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ module.exports = function render(url, res) {
});
let didError = false;
const data = createServerData();
const {startWriting, abort} = renderToNodePipe(
const {pipe, abort} = renderToNodePipe(
<DataProvider data={data}>
<App assets={assets} />
</DataProvider>,
Expand All @@ -46,7 +46,7 @@ module.exports = function render(url, res) {
// If something errored before we started streaming, we set the error code appropriately.
res.statusCode = didError ? 500 : 200;
res.setHeader('Content-type', 'text/html');
startWriting(res);
pipe(res);
},
onError(x) {
didError = true;
Expand Down
Loading

0 comments on commit 2af324a

Please sign in to comment.