Home / File/ ReactFiberTreeReflection.js — react Source File

ReactFiberTreeReflection.js — react Source File

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

File javascript BabelCompiler Validation 7 imports 3 dependents 11 functions

Entity Profile

Dependency Diagram

graph LR
  0dbcf9fa_e6db_e53a_9527_79526654a3ff["ReactFiberTreeReflection.js"]
  6b9f5caa_fb13_3d3c_2f60_ad3c4f58371f["ReactInternalTypes.js"]
  0dbcf9fa_e6db_e53a_9527_79526654a3ff --> 6b9f5caa_fb13_3d3c_2f60_ad3c4f58371f
  a6668d1d_397d_7807_719d_fdecf552fa4a["ReactFiberConfig.js"]
  0dbcf9fa_e6db_e53a_9527_79526654a3ff --> a6668d1d_397d_7807_719d_fdecf552fa4a
  6d56a395_c0fc_55d6_55fd_16373ba2eeee["ReactFiberActivityComponent.js"]
  0dbcf9fa_e6db_e53a_9527_79526654a3ff --> 6d56a395_c0fc_55d6_55fd_16373ba2eeee
  24334744_4c44_225b_6923_5be11133f949["ReactFiberSuspenseComponent.js"]
  0dbcf9fa_e6db_e53a_9527_79526654a3ff --> 24334744_4c44_225b_6923_5be11133f949
  d3557f30_4fca_e30a_91c5_c23d4b8dba99["ReactWorkTags.js"]
  0dbcf9fa_e6db_e53a_9527_79526654a3ff --> d3557f30_4fca_e30a_91c5_c23d4b8dba99
  6773f9a2_fdb7_4938_741f_4887273ad469["ReactFiberFlags.js"]
  0dbcf9fa_e6db_e53a_9527_79526654a3ff --> 6773f9a2_fdb7_4938_741f_4887273ad469
  8344de1b_978c_be0f_eebd_38ccc4962a93["ReactFeatureFlags"]
  0dbcf9fa_e6db_e53a_9527_79526654a3ff --> 8344de1b_978c_be0f_eebd_38ccc4962a93
  e0fbfbd5_47b0_a489_0b36_bbfad9245544["ReactFiberCommitWork.js"]
  e0fbfbd5_47b0_a489_0b36_bbfad9245544 --> 0dbcf9fa_e6db_e53a_9527_79526654a3ff
  3ff8c5da_88d9_c61b_6bdc_da766a43fd30["ReactFiberReconciler.js"]
  3ff8c5da_88d9_c61b_6bdc_da766a43fd30 --> 0dbcf9fa_e6db_e53a_9527_79526654a3ff
  86f2a181_6341_860e_6625_946a7d780c11["ReactFiberScope.js"]
  86f2a181_6341_860e_6625_946a7d780c11 --> 0dbcf9fa_e6db_e53a_9527_79526654a3ff
  style 0dbcf9fa_e6db_e53a_9527_79526654a3ff 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 {
  Container,
  ActivityInstance,
  SuspenseInstance,
} from './ReactFiberConfig';
import type {ActivityState} from './ReactFiberActivityComponent';
import type {SuspenseState} from './ReactFiberSuspenseComponent';

import {
  HostComponent,
  HostHoistable,
  HostSingleton,
  HostRoot,
  HostPortal,
  HostText,
  ActivityComponent,
  SuspenseComponent,
  OffscreenComponent,
  Fragment,
} from './ReactWorkTags';
import {NoFlags, Placement, Hydrating} from './ReactFiberFlags';
import {enableFragmentRefsTextNodes} from 'shared/ReactFeatureFlags';

export function getNearestMountedFiber(fiber: Fiber): null | Fiber {
  let node = fiber;
  let nearestMounted: null | Fiber = fiber;
  // If there is no alternate, this might be a new tree that isn't inserted
  // yet. If it is, then it will have a pending insertion effect on it.
  let nextNode: Fiber = node;
  while (nextNode && !nextNode.alternate) {
    node = nextNode;
    if ((node.flags & (Placement | Hydrating)) !== NoFlags) {
      // This is an insertion or in-progress hydration. The nearest possible
      // mounted fiber is the parent but we need to continue to figure out
      // if that one is still mounted.
      nearestMounted = node.return;
    }
    // $FlowFixMe[incompatible-type] we bail out when we get a null
    nextNode = node.return;
  }
  // After we've reached an alternate, go the rest of the way to see if the
  // tree is still mounted. If it's not, its return pointer will be disconnected.
  while (node.return) {
    node = node.return;
  }
  if (node.tag === HostRoot) {
    // TODO: Check if this was a nested HostRoot when used with
    // renderContainerIntoSubtree.
    return nearestMounted;
  }
// ... (630 more lines)

Domain

Subdomains

Frequently Asked Questions

What does ReactFiberTreeReflection.js do?
ReactFiberTreeReflection.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Validation subdomain.
What functions are defined in ReactFiberTreeReflection.js?
ReactFiberTreeReflection.js defines 11 function(s): assertIsMounted, doesFiberContain, fiberIsPortaledIntoHost, findCurrentHostFiberImpl, findCurrentHostFiberWithNoPortalsImpl, findFragmentInstanceSiblings, getActivityInstanceFromFiber, getSuspenseInstanceFromFiber, isFiberSuspenseAndTimedOut, sibling, and 1 more.
What does ReactFiberTreeReflection.js depend on?
ReactFiberTreeReflection.js imports 7 module(s): ReactFeatureFlags, ReactFiberActivityComponent.js, ReactFiberConfig.js, ReactFiberFlags.js, ReactFiberSuspenseComponent.js, ReactInternalTypes.js, ReactWorkTags.js.
What files import ReactFiberTreeReflection.js?
ReactFiberTreeReflection.js is imported by 3 file(s): ReactFiberCommitWork.js, ReactFiberReconciler.js, ReactFiberScope.js.
Where is ReactFiberTreeReflection.js in the architecture?
ReactFiberTreeReflection.js is located at packages/react-reconciler/src/ReactFiberTreeReflection.js (domain: BabelCompiler, subdomain: Validation, 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