Home / File/ ReactFiberStack.js — react Source File

ReactFiberStack.js — react Source File

Architecture documentation for ReactFiberStack.js, a javascript file in the react codebase. 1 imports, 7 dependents.

File javascript BabelCompiler 1 imports 7 dependents

Entity Profile

Dependency Diagram

graph LR
  8f731ef5_fa4f_fcf5_0d94_a73afa35b6a4["ReactFiberStack.js"]
  6b9f5caa_fb13_3d3c_2f60_ad3c4f58371f["ReactInternalTypes.js"]
  8f731ef5_fa4f_fcf5_0d94_a73afa35b6a4 --> 6b9f5caa_fb13_3d3c_2f60_ad3c4f58371f
  a53113f8_99e9_4566_6c5f_d1534c5c4ca8["ReactFiberHiddenContext.js"]
  a53113f8_99e9_4566_6c5f_d1534c5c4ca8 --> 8f731ef5_fa4f_fcf5_0d94_a73afa35b6a4
  0d0aab7d_e6b3_4636_e6ae_2ed95f8e42d0["ReactFiberHostContext.js"]
  0d0aab7d_e6b3_4636_e6ae_2ed95f8e42d0 --> 8f731ef5_fa4f_fcf5_0d94_a73afa35b6a4
  62553dd6_34d9_8b09_7c89_927d1610c445["ReactFiberLegacyContext.js"]
  62553dd6_34d9_8b09_7c89_927d1610c445 --> 8f731ef5_fa4f_fcf5_0d94_a73afa35b6a4
  278c890a_abdf_e007_0c26_ae3bc8eda908["ReactFiberNewContext.js"]
  278c890a_abdf_e007_0c26_ae3bc8eda908 --> 8f731ef5_fa4f_fcf5_0d94_a73afa35b6a4
  be9c7dd4_0030_1768_3ad3_f5acdbd08eef["ReactFiberSuspenseContext.js"]
  be9c7dd4_0030_1768_3ad3_f5acdbd08eef --> 8f731ef5_fa4f_fcf5_0d94_a73afa35b6a4
  05714c8c_b2f5_ddac_3f79_222b33006713["ReactFiberTracingMarkerComponent.js"]
  05714c8c_b2f5_ddac_3f79_222b33006713 --> 8f731ef5_fa4f_fcf5_0d94_a73afa35b6a4
  7b9cb3e8_e71c_27b2_61e8_fe54f0f80f0b["ReactFiberTransition.js"]
  7b9cb3e8_e71c_27b2_61e8_fe54f0f80f0b --> 8f731ef5_fa4f_fcf5_0d94_a73afa35b6a4
  style 8f731ef5_fa4f_fcf5_0d94_a73afa35b6a4 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

/**
 * 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 {Fiber} from './ReactInternalTypes';

export type StackCursor<T> = {current: T};

const valueStack: Array<any> = [];

let fiberStack: Array<Fiber | null>;

if (__DEV__) {
  fiberStack = [];
}

let index = -1;

function createCursor<T>(defaultValue: T): StackCursor<T> {
  return {
    current: defaultValue,
  };
}

function pop<T>(cursor: StackCursor<T>, fiber: Fiber): void {
  if (index < 0) {
    if (__DEV__) {
      console.error('Unexpected pop.');
    }
    return;
  }

  if (__DEV__) {
    if (fiber !== fiberStack[index]) {
      console.error('Unexpected Fiber popped.');
    }
  }

  cursor.current = valueStack[index];

  valueStack[index] = null;

  if (__DEV__) {
    fiberStack[index] = null;
  }

  index--;
}

function push<T>(cursor: StackCursor<T>, value: T, fiber: Fiber): void {
  index++;

  valueStack[index] = cursor.current;

  if (__DEV__) {
    fiberStack[index] = fiber;
  }

  cursor.current = value;
}
export {createCursor, pop, push};

Domain

Dependencies

Frequently Asked Questions

What does ReactFiberStack.js do?
ReactFiberStack.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain.
What does ReactFiberStack.js depend on?
ReactFiberStack.js imports 1 module(s): ReactInternalTypes.js.
What files import ReactFiberStack.js?
ReactFiberStack.js is imported by 7 file(s): ReactFiberHiddenContext.js, ReactFiberHostContext.js, ReactFiberLegacyContext.js, ReactFiberNewContext.js, ReactFiberSuspenseContext.js, ReactFiberTracingMarkerComponent.js, ReactFiberTransition.js.
Where is ReactFiberStack.js in the architecture?
ReactFiberStack.js is located at packages/react-reconciler/src/ReactFiberStack.js (domain: BabelCompiler, directory: packages/react-reconciler/src).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free