Skip to content

Commit b28626f

Browse files
committed
Rename onComplete -> onCompleteAll
1 parent 0509b57 commit b28626f

File tree

6 files changed

+15
-15
lines changed

6 files changed

+15
-15
lines changed

packages/react-dom/src/__tests__/ReactDOMFizzServerBrowser-test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ describe('ReactDOMFizzServer', () => {
7777
</Suspense>
7878
</div>,
7979
{
80-
onComplete() {
80+
onCompleteAll() {
8181
isComplete = true;
8282
},
8383
},

packages/react-dom/src/__tests__/ReactDOMFizzServerNode-test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ describe('ReactDOMFizzServer', () => {
107107
</div>,
108108
writable,
109109
{
110-
onComplete() {
110+
onCompleteAll() {
111111
isComplete = true;
112112
},
113113
},

packages/react-dom/src/server/ReactDOMFizzServerBrowser.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ type Options = {
2323
progressiveChunkSize?: number,
2424
signal?: AbortSignal,
2525
onReadyToStream?: () => void,
26-
onComplete?: () => void,
26+
onCompleteAll?: () => void,
2727
onError?: (error: mixed) => void,
2828
};
2929

@@ -48,7 +48,7 @@ function renderToReadableStream(
4848
createResponseState(options ? options.identifierPrefix : undefined),
4949
options ? options.progressiveChunkSize : undefined,
5050
options ? options.onError : undefined,
51-
options ? options.onComplete : undefined,
51+
options ? options.onCompleteAll : undefined,
5252
options ? options.onReadyToStream : undefined,
5353
);
5454
startWork(request);

packages/react-dom/src/server/ReactDOMFizzServerNode.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ type Options = {
2727
identifierPrefix?: string,
2828
progressiveChunkSize?: number,
2929
onReadyToStream?: () => void,
30-
onComplete?: () => void,
30+
onCompleteAll?: () => void,
3131
onError?: (error: mixed) => void,
3232
};
3333

@@ -48,7 +48,7 @@ function pipeToNodeWritable(
4848
createResponseState(options ? options.identifierPrefix : undefined),
4949
options ? options.progressiveChunkSize : undefined,
5050
options ? options.onError : undefined,
51-
options ? options.onComplete : undefined,
51+
options ? options.onCompleteAll : undefined,
5252
options ? options.onReadyToStream : undefined,
5353
);
5454
let hasStartedFlowing = false;

packages/react-noop-renderer/src/ReactNoopServer.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ const ReactNoopServer = ReactFizzServer({
218218
type Options = {
219219
progressiveChunkSize?: number,
220220
onReadyToStream?: () => void,
221-
onComplete?: () => void,
221+
onCompleteAll?: () => void,
222222
onError?: (error: mixed) => void,
223223
};
224224

@@ -238,7 +238,7 @@ function render(children: React$Element<any>, options?: Options): Destination {
238238
null,
239239
options ? options.progressiveChunkSize : undefined,
240240
options ? options.onError : undefined,
241-
options ? options.onComplete : undefined,
241+
options ? options.onCompleteAll : undefined,
242242
options ? options.onReadyToStream : undefined,
243243
);
244244
ReactNoopServer.startWork(request);

packages/react-server/src/ReactFizzServer.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ type Request = {
112112
partialBoundaries: Array<SuspenseBoundary>, // Partially completed boundaries that can flush its segments early.
113113
// onError is called when an error happens anywhere in the tree. It might recover.
114114
onError: (error: mixed) => void,
115-
// onComplete is called when all pending work is done but it may not have flushed yet.
115+
// onCompleteAll is called when all pending work is done but it may not have flushed yet.
116116
// This is a good time to start writing if you want only HTML and no intermediate steps.
117-
onComplete: () => void,
117+
onCompleteAll: () => void,
118118
// onReadyToStream is called when there is at least a root fallback ready to show.
119119
// Typically you don't need this callback because it's best practice to always have a
120120
// root fallback ready so there's no need to wait.
@@ -144,7 +144,7 @@ export function createRequest(
144144
responseState: ResponseState,
145145
progressiveChunkSize: number = DEFAULT_PROGRESSIVE_CHUNK_SIZE,
146146
onError: (error: mixed) => void = noop,
147-
onComplete: () => void = noop,
147+
onCompleteAll: () => void = noop,
148148
onReadyToStream: () => void = noop,
149149
): Request {
150150
const pingedWork = [];
@@ -164,7 +164,7 @@ export function createRequest(
164164
completedBoundaries: [],
165165
partialBoundaries: [],
166166
onError,
167-
onComplete,
167+
onCompleteAll,
168168
onReadyToStream,
169169
};
170170
// This segment represents the root fallback.
@@ -429,7 +429,7 @@ function erroredWork(
429429

430430
request.allPendingWork--;
431431
if (request.allPendingWork === 0) {
432-
request.onComplete();
432+
request.onCompleteAll();
433433
}
434434
}
435435

@@ -476,7 +476,7 @@ function abortWork(suspendedWork: SuspendedWork): void {
476476
}
477477

478478
if (request.allPendingWork === 0) {
479-
request.onComplete();
479+
request.onCompleteAll();
480480
}
481481
}
482482
}
@@ -537,7 +537,7 @@ function finishedWork(
537537
if (request.allPendingWork === 0) {
538538
// This needs to be called at the very end so that we can synchronously write the result
539539
// in the callback if needed.
540-
request.onComplete();
540+
request.onCompleteAll();
541541
}
542542
}
543543

0 commit comments

Comments
 (0)