Files
react/packages/react-server/src/ReactFizzCurrentTask.js
Sebastian Markbåge 315109b02b [Fizz] Enable owner stacks for SSR (#30152)
Stacked on #30142.

This tracks owners and their stacks in DEV in Fizz. We use the
ComponentStackNode as the data structure to track this information -
effectively like ReactComponentInfo (Server) or Fiber (Client). They're
the instance.

I then port them same logic from ReactFiberComponentStack,
ReactFiberOwnerStack and ReactFiberCallUserSpace to Fizz equivalents.

This gets us both owner stacks from `captureOwnerStack()`, as well as
appended to console.errors logged by Fizz, while rendering and in
onError.
2024-07-01 10:27:52 -04:00

20 lines
476 B
JavaScript

/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
import type {Task} from './ReactFizzServer';
// DEV-only global reference to the currently executing task
export let currentTaskInDEV: null | Task = null;
export function setCurrentTaskInDEV(task: null | Task): void {
if (__DEV__) {
currentTaskInDEV = task;
}
}