mirror of
https://github.com/facebook/react.git
synced 2026-02-24 04:33:04 +00:00
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.
20 lines
476 B
JavaScript
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;
|
|
}
|
|
}
|