Home / File/ ReactFiberScope.js — react Source File

ReactFiberScope.js — react Source File

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

File javascript BabelCompiler 7 imports 1 dependents

Entity Profile

Dependency Diagram

graph LR
  86f2a181_6341_860e_6625_946a7d780c11["ReactFiberScope.js"]
  6b9f5caa_fb13_3d3c_2f60_ad3c4f58371f["ReactInternalTypes.js"]
  86f2a181_6341_860e_6625_946a7d780c11 --> 6b9f5caa_fb13_3d3c_2f60_ad3c4f58371f
  a6668d1d_397d_7807_719d_fdecf552fa4a["ReactFiberConfig.js"]
  86f2a181_6341_860e_6625_946a7d780c11 --> a6668d1d_397d_7807_719d_fdecf552fa4a
  0dbcf9fa_e6db_e53a_9527_79526654a3ff["ReactFiberTreeReflection.js"]
  86f2a181_6341_860e_6625_946a7d780c11 --> 0dbcf9fa_e6db_e53a_9527_79526654a3ff
  1ffa15d1_75e9_7a89_7dc4_86ae769868b9["isFiberSuspenseAndTimedOut"]
  86f2a181_6341_860e_6625_946a7d780c11 --> 1ffa15d1_75e9_7a89_7dc4_86ae769868b9
  d3557f30_4fca_e30a_91c5_c23d4b8dba99["ReactWorkTags.js"]
  86f2a181_6341_860e_6625_946a7d780c11 --> d3557f30_4fca_e30a_91c5_c23d4b8dba99
  d8f20c67_f5fa_0f0a_c967_c41fd9ffce07["ReactTypes"]
  86f2a181_6341_860e_6625_946a7d780c11 --> d8f20c67_f5fa_0f0a_c967_c41fd9ffce07
  8344de1b_978c_be0f_eebd_38ccc4962a93["ReactFeatureFlags"]
  86f2a181_6341_860e_6625_946a7d780c11 --> 8344de1b_978c_be0f_eebd_38ccc4962a93
  6b05669d_2f09_63a5_e79f_0afc195f25a3["ReactFiberCompleteWork.js"]
  6b05669d_2f09_63a5_e79f_0afc195f25a3 --> 86f2a181_6341_860e_6625_946a7d780c11
  style 86f2a181_6341_860e_6625_946a7d780c11 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';
import type {
  ReactScopeInstance,
  ReactContext,
  ReactScopeQuery,
} from 'shared/ReactTypes';

import {
  getPublicInstance,
  getInstanceFromNode,
  getInstanceFromScope,
} from './ReactFiberConfig';
import {isFiberSuspenseAndTimedOut} from './ReactFiberTreeReflection';

import {HostComponent, ScopeComponent, ContextProvider} from './ReactWorkTags';
import {enableScopeAPI} from 'shared/ReactFeatureFlags';

function getSuspenseFallbackChild(fiber: Fiber): Fiber | null {
  return ((((fiber.child: any): Fiber).sibling: any): Fiber).child;
}

const emptyObject = {};

function collectScopedNodes(
  node: Fiber,
  fn: ReactScopeQuery,
  scopedNodes: Array<any>,
): void {
  if (enableScopeAPI) {
    if (node.tag === HostComponent) {
      const {type, memoizedProps, stateNode} = node;
      const instance = getPublicInstance(stateNode);
      if (
        instance !== null &&
        fn(type, memoizedProps || emptyObject, instance) === true
      ) {
        scopedNodes.push(instance);
      }
    }
    let child = node.child;

    if (isFiberSuspenseAndTimedOut(node)) {
      child = getSuspenseFallbackChild(node);
    }
    if (child !== null) {
      collectScopedNodesFromChildren(child, fn, scopedNodes);
    }
  }
}

function collectFirstScopedNode(
// ... (149 more lines)

Domain

Frequently Asked Questions

What does ReactFiberScope.js do?
ReactFiberScope.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain.
What does ReactFiberScope.js depend on?
ReactFiberScope.js imports 7 module(s): ReactFeatureFlags, ReactFiberConfig.js, ReactFiberTreeReflection.js, ReactInternalTypes.js, ReactTypes, ReactWorkTags.js, isFiberSuspenseAndTimedOut.
What files import ReactFiberScope.js?
ReactFiberScope.js is imported by 1 file(s): ReactFiberCompleteWork.js.
Where is ReactFiberScope.js in the architecture?
ReactFiberScope.js is located at packages/react-reconciler/src/ReactFiberScope.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