Skip to content

Commit

Permalink
Rename onComplete -> onCompleteAll
Browse files Browse the repository at this point in the history
  • Loading branch information
sebmarkbage committed Mar 23, 2021
1 parent 0509b57 commit a2f0399
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ describe('ReactDOMFizzServer', () => {
</Suspense>
</div>,
{
onComplete() {
onCompleteAll() {
isComplete = true;
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ describe('ReactDOMFizzServer', () => {
</div>,
writable,
{
onComplete() {
onCompleteAll() {
isComplete = true;
},
},
Expand Down
4 changes: 2 additions & 2 deletions packages/react-dom/src/server/ReactDOMFizzServerBrowser.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type Options = {
progressiveChunkSize?: number,
signal?: AbortSignal,
onReadyToStream?: () => void,
onComplete?: () => void,
onCompleteAll?: () => void,
onError?: (error: mixed) => void,
};

Expand All @@ -48,7 +48,7 @@ function renderToReadableStream(
createResponseState(options ? options.identifierPrefix : undefined),
options ? options.progressiveChunkSize : undefined,
options ? options.onError : undefined,
options ? options.onComplete : undefined,
options ? options.onCompleteAll : undefined,
options ? options.onReadyToStream : undefined,
);
startWork(request);
Expand Down
4 changes: 2 additions & 2 deletions packages/react-dom/src/server/ReactDOMFizzServerNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ type Options = {
identifierPrefix?: string,
progressiveChunkSize?: number,
onReadyToStream?: () => void,
onComplete?: () => void,
onCompleteAll?: () => void,
onError?: (error: mixed) => void,
};

Expand All @@ -48,7 +48,7 @@ function pipeToNodeWritable(
createResponseState(options ? options.identifierPrefix : undefined),
options ? options.progressiveChunkSize : undefined,
options ? options.onError : undefined,
options ? options.onComplete : undefined,
options ? options.onCompleteAll : undefined,
options ? options.onReadyToStream : undefined,
);
let hasStartedFlowing = false;
Expand Down
4 changes: 2 additions & 2 deletions packages/react-noop-renderer/src/ReactNoopServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ const ReactNoopServer = ReactFizzServer({
type Options = {
progressiveChunkSize?: number,
onReadyToStream?: () => void,
onComplete?: () => void,
onCompleteAll?: () => void,
onError?: (error: mixed) => void,
};

Expand All @@ -238,7 +238,7 @@ function render(children: React$Element<any>, options?: Options): Destination {
null,
options ? options.progressiveChunkSize : undefined,
options ? options.onError : undefined,
options ? options.onComplete : undefined,
options ? options.onCompleteAll : undefined,
options ? options.onReadyToStream : undefined,
);
ReactNoopServer.startWork(request);
Expand Down
14 changes: 7 additions & 7 deletions packages/react-server/src/ReactFizzServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ type Request = {
partialBoundaries: Array<SuspenseBoundary>, // Partially completed boundaries that can flush its segments early.
// onError is called when an error happens anywhere in the tree. It might recover.
onError: (error: mixed) => void,
// onComplete is called when all pending work is done but it may not have flushed yet.
// onCompleteAll is called when all pending work is done but it may not have flushed yet.
// This is a good time to start writing if you want only HTML and no intermediate steps.
onComplete: () => void,
onCompleteAll: () => void,
// onReadyToStream is called when there is at least a root fallback ready to show.
// Typically you don't need this callback because it's best practice to always have a
// root fallback ready so there's no need to wait.
Expand Down Expand Up @@ -144,7 +144,7 @@ export function createRequest(
responseState: ResponseState,
progressiveChunkSize: number = DEFAULT_PROGRESSIVE_CHUNK_SIZE,
onError: (error: mixed) => void = noop,
onComplete: () => void = noop,
onCompleteAll: () => void = noop,
onReadyToStream: () => void = noop,
): Request {
const pingedWork = [];
Expand All @@ -164,7 +164,7 @@ export function createRequest(
completedBoundaries: [],
partialBoundaries: [],
onError,
onComplete,
onCompleteAll,
onReadyToStream,
};
// This segment represents the root fallback.
Expand Down Expand Up @@ -429,7 +429,7 @@ function erroredWork(

request.allPendingWork--;
if (request.allPendingWork === 0) {
request.onComplete();
request.onCompleteAll();
}
}

Expand Down Expand Up @@ -476,7 +476,7 @@ function abortWork(suspendedWork: SuspendedWork): void {
}

if (request.allPendingWork === 0) {
request.onComplete();
request.onCompleteAll();
}
}
}
Expand Down Expand Up @@ -537,7 +537,7 @@ function finishedWork(
if (request.allPendingWork === 0) {
// This needs to be called at the very end so that we can synchronously write the result
// in the callback if needed.
request.onComplete();
request.onCompleteAll();
}
}

Expand Down

0 comments on commit a2f0399

Please sign in to comment.