GeezerVison is showing github.com — Rename onReadyToStream to onCompleteShell (#22443) · react/react@2cc6d79
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: fixtures/ssr/server/render.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -24,7 +24,7 @@ export default function render(url, res) { | 24 | 24 | <App assets={assets} />, | 25 | 25 | res, | 26 | 26 | { | 27 | | - onReadyToStream() { | | 27 | + onCompleteShell() { | 28 | 28 | // If something errored before we started streaming, we set the error code appropriately. | 29 | 29 | res.statusCode = didError ? 500 : 200; | 30 | 30 | res.setHeader('Content-type', 'text/html'); | |
Collapse file Copy file name to clipboardExpand all lines: fixtures/ssr2/server/render.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -43,7 +43,7 @@ module.exports = function render(url, res) { | 43 | 43 | </DataProvider>, | 44 | 44 | res, | 45 | 45 | { | 46 | | - onReadyToStream() { | | 46 | + onCompleteShell() { | 47 | 47 | // If something errored before we started streaming, we set the error code appropriately. | 48 | 48 | res.statusCode = didError ? 500 : 200; | 49 | 49 | res.setHeader('Content-type', 'text/html'); | |
Collapse file Copy file name to clipboardExpand all lines: packages/react-dom/src/__tests__/ReactDOMFizzServer-test.js +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -768,7 +768,7 @@ describe('ReactDOMFizzServer', () => { | 768 | 768 | writableA, | 769 | 769 | { | 770 | 770 | identifierPrefix: 'A_', | 771 | | - onReadyToStream() { | | 771 | + onCompleteShell() { | 772 | 772 | writableA.write('<div id="container-A">'); | 773 | 773 | startWriting(); | 774 | 774 | writableA.write('</div>'); | @@ -788,7 +788,7 @@ describe('ReactDOMFizzServer', () => { | 788 | 788 | writableB, | 789 | 789 | { | 790 | 790 | identifierPrefix: 'B_', | 791 | | - onReadyToStream() { | | 791 | + onCompleteShell() { | 792 | 792 | writableB.write('<div id="container-B">'); | 793 | 793 | startWriting(); | 794 | 794 | writableB.write('</div>'); | @@ -1029,7 +1029,7 @@ describe('ReactDOMFizzServer', () => { | 1029 | 1029 | writable, | 1030 | 1030 | { | 1031 | 1031 | namespaceURI: 'http://www.w3.org/2000/svg', | 1032 | | - onReadyToStream() { | | 1032 | + onCompleteShell() { | 1033 | 1033 | writable.write('<svg>'); | 1034 | 1034 | startWriting(); | 1035 | 1035 | writable.write('</svg>'); | |
Collapse file Copy file name to clipboardExpand all lines: packages/react-dom/src/server/ReactDOMFizzServerBrowser.js +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -28,7 +28,7 @@ type Options = {| | 28 | 28 | namespaceURI?: string, | 29 | 29 | progressiveChunkSize?: number, | 30 | 30 | signal?: AbortSignal, | 31 | | - onReadyToStream?: () => void, | | 31 | + onCompleteShell?: () => void, | 32 | 32 | onCompleteAll?: () => void, | 33 | 33 | onError?: (error: mixed) => void, | 34 | 34 | |}; | @@ -56,7 +56,7 @@ function renderToReadableStream( | 56 | 56 | options ? options.progressiveChunkSize : undefined, | 57 | 57 | options ? options.onError : undefined, | 58 | 58 | options ? options.onCompleteAll : undefined, | 59 | | - options ? options.onReadyToStream : undefined, | | 59 | + options ? options.onCompleteShell : undefined, | 60 | 60 | ); | 61 | 61 | startWork(request); | 62 | 62 | }, | |
Collapse file Copy file name to clipboardExpand all lines: packages/react-dom/src/server/ReactDOMFizzServerNode.js +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -32,7 +32,7 @@ type Options = {| | 32 | 32 | identifierPrefix?: string, | 33 | 33 | namespaceURI?: string, | 34 | 34 | progressiveChunkSize?: number, | 35 | | - onReadyToStream?: () => void, | | 35 | + onCompleteShell?: () => void, | 36 | 36 | onCompleteAll?: () => void, | 37 | 37 | onError?: (error: mixed) => void, | 38 | 38 | |}; | @@ -57,7 +57,7 @@ function createRequestImpl( | 57 | 57 | options ? options.progressiveChunkSize : undefined, | 58 | 58 | options ? options.onError : undefined, | 59 | 59 | options ? options.onCompleteAll : undefined, | 60 | | - options ? options.onReadyToStream : undefined, | | 60 | + options ? options.onCompleteShell : undefined, | 61 | 61 | ); | 62 | 62 | } | 63 | 63 |
| |
Collapse file Copy file name to clipboardExpand all lines: packages/react-dom/src/server/ReactDOMLegacyServerBrowser.js +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -54,7 +54,7 @@ function renderToStringImpl( | 54 | 54 | }; | 55 | 55 |
| 56 | 56 | let readyToStream = false; | 57 | | - function onReadyToStream() { | | 57 | + function onCompleteShell() { | 58 | 58 | readyToStream = true; | 59 | 59 | } | 60 | 60 | const request = createRequest( | @@ -68,7 +68,7 @@ function renderToStringImpl( | 68 | 68 | Infinity, | 69 | 69 | onError, | 70 | 70 | undefined, | 71 | | - onReadyToStream, | | 71 | + onCompleteShell, | 72 | 72 | ); | 73 | 73 | startWork(request); | 74 | 74 | // If anything suspended and is still pending, we'll abort it before writing. | |
Collapse file Copy file name to clipboardExpand all lines: packages/react-noop-renderer/src/ReactNoopServer.js +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -242,7 +242,7 @@ const ReactNoopServer = ReactFizzServer({ | 242 | 242 |
| 243 | 243 | type Options = { | 244 | 244 | progressiveChunkSize?: number, | 245 | | - onReadyToStream?: () => void, | | 245 | + onCompleteShell?: () => void, | 246 | 246 | onCompleteAll?: () => void, | 247 | 247 | onError?: (error: mixed) => void, | 248 | 248 | }; | @@ -265,7 +265,7 @@ function render(children: React$Element<any>, options?: Options): Destination { | 265 | 265 | options ? options.progressiveChunkSize : undefined, | 266 | 266 | options ? options.onError : undefined, | 267 | 267 | options ? options.onCompleteAll : undefined, | 268 | | - options ? options.onReadyToStream : undefined, | | 268 | + options ? options.onCompleteShell : undefined, | 269 | 269 | ); | 270 | 270 | ReactNoopServer.startWork(request); | 271 | 271 | ReactNoopServer.startFlowing(request); | |
Collapse file Copy file name to clipboardExpand all lines: packages/react-server/src/ReactFizzServer.js +6-6Lines changed: 6 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -190,10 +190,10 @@ export opaque type Request = { | 190 | 190 | // onCompleteAll is called when all pending task is done but it may not have flushed yet. | 191 | 191 | // This is a good time to start writing if you want only HTML and no intermediate steps. | 192 | 192 | onCompleteAll: () => void, | 193 | | - // onReadyToStream is called when there is at least a root fallback ready to show. | | 193 | + // onCompleteShell is called when there is at least a root fallback ready to show. | 194 | 194 | // Typically you don't need this callback because it's best practice to always have a | 195 | 195 | // root fallback ready so there's no need to wait. | 196 | | - onReadyToStream: () => void, | | 196 | + onCompleteShell: () => void, | 197 | 197 | }; | 198 | 198 |
| 199 | 199 | // This is a default heuristic for how to split up the HTML content into progressive | @@ -227,7 +227,7 @@ export function createRequest( | 227 | 227 | progressiveChunkSize: void | number, | 228 | 228 | onError: void | ((error: mixed) => void), | 229 | 229 | onCompleteAll: void | (() => void), | 230 | | - onReadyToStream: void | (() => void), | | 230 | + onCompleteShell: void | (() => void), | 231 | 231 | ): Request { | 232 | 232 | const pingedTasks = []; | 233 | 233 | const abortSet: Set<Task> = new Set(); | @@ -250,7 +250,7 @@ export function createRequest( | 250 | 250 | partialBoundaries: [], | 251 | 251 | onError: onError === undefined ? defaultErrorHandler : onError, | 252 | 252 | onCompleteAll: onCompleteAll === undefined ? noop : onCompleteAll, | 253 | | - onReadyToStream: onReadyToStream === undefined ? noop : onReadyToStream, | | 253 | + onCompleteShell: onCompleteShell === undefined ? noop : onCompleteShell, | 254 | 254 | }; | 255 | 255 | // This segment represents the root fallback. | 256 | 256 | const rootSegment = createPendingSegment(request, 0, null, rootFormatContext); | @@ -1370,8 +1370,8 @@ function finishedTask( | 1370 | 1370 | } | 1371 | 1371 | request.pendingRootTasks--; | 1372 | 1372 | if (request.pendingRootTasks === 0) { | 1373 | | - const onReadyToStream = request.onReadyToStream; | 1374 | | - onReadyToStream(); | | 1373 | + const onCompleteShell = request.onCompleteShell; | | 1374 | + onCompleteShell(); | 1375 | 1375 | } | 1376 | 1376 | } else { | 1377 | 1377 | boundary.pendingTasks--; | |
|