Home / File/ ReactFizzNewContext.js — react Source File

ReactFizzNewContext.js — react Source File

Architecture documentation for ReactFizzNewContext.js, a javascript file in the react codebase. 2 imports, 3 dependents.

File javascript BabelCompiler 2 imports 3 dependents

Entity Profile

Dependency Diagram

graph LR
  0cfcefe7_6b5a_1519_f6c8_eefc299c4b12["ReactFizzNewContext.js"]
  7a7f357d_7b45_550b_09d7_ec9967c0e9ef["ReactFizzConfig.js"]
  0cfcefe7_6b5a_1519_f6c8_eefc299c4b12 --> 7a7f357d_7b45_550b_09d7_ec9967c0e9ef
  d8f20c67_f5fa_0f0a_c967_c41fd9ffce07["ReactTypes"]
  0cfcefe7_6b5a_1519_f6c8_eefc299c4b12 --> d8f20c67_f5fa_0f0a_c967_c41fd9ffce07
  8f850c79_0562_f37f_80ff_563c50cd0996["ReactFizzClassComponent.js"]
  8f850c79_0562_f37f_80ff_563c50cd0996 --> 0cfcefe7_6b5a_1519_f6c8_eefc299c4b12
  62bbc5a9_96f5_01de_8910_fb5c249aaf87["ReactFizzHooks.js"]
  62bbc5a9_96f5_01de_8910_fb5c249aaf87 --> 0cfcefe7_6b5a_1519_f6c8_eefc299c4b12
  1b694821_5816_1762_7c98_f0727a09e732["ReactFizzServer.js"]
  1b694821_5816_1762_7c98_f0727a09e732 --> 0cfcefe7_6b5a_1519_f6c8_eefc299c4b12
  style 0cfcefe7_6b5a_1519_f6c8_eefc299c4b12 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 {ReactContext} from 'shared/ReactTypes';

import {isPrimaryRenderer} from './ReactFizzConfig';

let rendererSigil;
if (__DEV__) {
  // Use this to detect multiple renderers using the same context
  rendererSigil = {};
}

// Used to store the parent path of all context overrides in a shared linked list.
// Forming a reverse tree.
type ContextNode<T> = {
  parent: null | ContextNode<any>,
  depth: number, // Short hand to compute the depth of the tree at this node.
  context: ReactContext<T>,
  parentValue: T,
  value: T,
};

// The structure of a context snapshot is an implementation of this file.
// Currently, it's implemented as tracking the current active node.
export opaque type ContextSnapshot = null | ContextNode<any>;

export const rootContextSnapshot: ContextSnapshot = null;

// We assume that this runtime owns the "current" field on all ReactContext instances.
// This global (actually thread local) state represents what state all those "current",
// fields are currently in.
let currentActiveSnapshot: ContextSnapshot = null;

function popNode(prev: ContextNode<any>): void {
  if (isPrimaryRenderer) {
    prev.context._currentValue = prev.parentValue;
  } else {
    prev.context._currentValue2 = prev.parentValue;
  }
}

function pushNode(next: ContextNode<any>): void {
  if (isPrimaryRenderer) {
    next.context._currentValue = next.value;
  } else {
    next.context._currentValue2 = next.value;
  }
}

function popToNearestCommonAncestor(
  prev: ContextNode<any>,
  next: ContextNode<any>,
): void {
// ... (232 more lines)

Domain

Dependencies

Frequently Asked Questions

What does ReactFizzNewContext.js do?
ReactFizzNewContext.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain.
What does ReactFizzNewContext.js depend on?
ReactFizzNewContext.js imports 2 module(s): ReactFizzConfig.js, ReactTypes.
What files import ReactFizzNewContext.js?
ReactFizzNewContext.js is imported by 3 file(s): ReactFizzClassComponent.js, ReactFizzHooks.js, ReactFizzServer.js.
Where is ReactFizzNewContext.js in the architecture?
ReactFizzNewContext.js is located at packages/react-server/src/ReactFizzNewContext.js (domain: BabelCompiler, directory: packages/react-server/src).

Analyze Your Own Codebase

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

Try Supermodel Free