Skip to content

Commit

Permalink
Move pendingChunks ref count increment into createTask
Browse files Browse the repository at this point in the history
  • Loading branch information
sebmarkbage committed Feb 6, 2024
1 parent 30e2938 commit 9c17e1b
Showing 1 changed file with 1 addition and 4 deletions.
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

0 comments on commit 9c17e1b

Please sign in to comment.