Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Flight] Move pendingChunks ref count increment into createTask #28260

Merged
merged 1 commit into from
Feb 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions packages/react-server/src/ReactFlightServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,6 @@ export function createRequest(
onError: onError === undefined ? defaultErrorHandler : onError,
onPostpone: onPostpone === undefined ? defaultPostponeHandler : onPostpone,
};
request.pendingChunks++;
const rootTask = createTask(request, model, null, false, abortSet);
pingedTasks.push(rootTask);
return request;
Expand All @@ -318,7 +317,6 @@ function serializeThenable(
task: Task,
thenable: Thenable<any>,
): number {
request.pendingChunks++;
const newTask = createTask(
request,
null,
Expand Down Expand Up @@ -722,6 +720,7 @@ function createTask(
implicitSlot: boolean,
abortSet: Set<Task>,
): Task {
request.pendingChunks++;
const id = request.nextChunkId++;
if (typeof model === 'object' && model !== null) {
// If we're about to write this into a new task we can assign it an ID early so that
Expand Down Expand Up @@ -906,7 +905,6 @@ function serializeClientReference(
}

function outlineModel(request: Request, value: ReactClientValue): number {
request.pendingChunks++;
const newTask = createTask(
request,
value,
Expand Down Expand Up @@ -1068,7 +1066,6 @@ function renderModel(
// $FlowFixMe[method-unbinding]
if (typeof x.then === 'function') {
// Something suspended, we'll need to create a new task and resolve it later.
request.pendingChunks++;
const newTask = createTask(
request,
task.model,
Expand Down