Skip to content

Commit

Permalink
Run in owner task context
Browse files Browse the repository at this point in the history
  • Loading branch information
sebmarkbage committed May 29, 2024
1 parent e68e81e commit 592ad3f
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions packages/react-client/src/ReactFlightClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -1731,18 +1731,24 @@ function initializeFakeTask(
if (cachedEntry !== undefined) {
return cachedEntry;
}
const owner: ?ReactComponentInfo = componentInfo.owner;
if (owner != null) {
initializeFakeTask(owner);
}

const ownerTask =
componentInfo.owner == null
? null
: initializeFakeTask(componentInfo.owner);

// eslint-disable-next-line react-internal/no-production-logging
const createTaskFn = (console: any).createTask.bind(
console,
getServerComponentTaskName(componentInfo),
);
const callStack = buildFakeCallStack(stack, createTaskFn);
return callStack();

if (ownerTask === null) {
return callStack();
} else {
return ownerTask.run(callStack);
}
}

function resolveDebugInfo(
Expand Down

0 comments on commit 592ad3f

Please sign in to comment.