Home / File/ ReactFiberMutationTracking.js — react Source File

ReactFiberMutationTracking.js — react Source File

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

File javascript BabelCompiler Validation 1 imports 3 dependents 4 functions

Entity Profile

Dependency Diagram

graph LR
  1a6f1ac9_f5f1_3a2e_6503_c920a4d4a8ae["ReactFiberMutationTracking.js"]
  8344de1b_978c_be0f_eebd_38ccc4962a93["ReactFeatureFlags"]
  1a6f1ac9_f5f1_3a2e_6503_c920a4d4a8ae --> 8344de1b_978c_be0f_eebd_38ccc4962a93
  ee850b36_fc0b_9bb2_5b69_58d705aef9a5["ReactFiberApplyGesture.js"]
  ee850b36_fc0b_9bb2_5b69_58d705aef9a5 --> 1a6f1ac9_f5f1_3a2e_6503_c920a4d4a8ae
  d39520cc_fe89_c0bc_424d_91bccdb79a69["ReactFiberCommitHostEffects.js"]
  d39520cc_fe89_c0bc_424d_91bccdb79a69 --> 1a6f1ac9_f5f1_3a2e_6503_c920a4d4a8ae
  e0fbfbd5_47b0_a489_0b36_bbfad9245544["ReactFiberCommitWork.js"]
  e0fbfbd5_47b0_a489_0b36_bbfad9245544 --> 1a6f1ac9_f5f1_3a2e_6503_c920a4d4a8ae
  style 1a6f1ac9_f5f1_3a2e_6503_c920a4d4a8ae 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 {
  enableDefaultTransitionIndicator,
  enableViewTransition,
} from 'shared/ReactFeatureFlags';

export let rootMutationContext: boolean = false;
export let viewTransitionMutationContext: boolean = false;

export function pushRootMutationContext(): void {
  if (enableDefaultTransitionIndicator) {
    rootMutationContext = false;
  }
  if (enableViewTransition) {
    viewTransitionMutationContext = false;
  }
}

export function pushMutationContext(): boolean {
  if (!enableViewTransition) {
    return false;
  }
  const prev = viewTransitionMutationContext;
  viewTransitionMutationContext = false;
  return prev;
}

export function popMutationContext(prev: boolean): void {
  if (enableViewTransition) {
    if (viewTransitionMutationContext) {
      rootMutationContext = true;
    }
    viewTransitionMutationContext = prev;
  }
}

export function trackHostMutation(): void {
  // This is extremely hot function that must be inlined. Don't add more stuff.
  if (enableViewTransition) {
    viewTransitionMutationContext = true;
  } else if (enableDefaultTransitionIndicator) {
    // We only set this if enableViewTransition is not on. Otherwise we track
    // it on the viewTransitionMutationContext and collect it when we pop
    // to avoid more than a single operation in this hot path.
    rootMutationContext = true;
  }
}

Domain

Subdomains

Dependencies

  • ReactFeatureFlags

Frequently Asked Questions

What does ReactFiberMutationTracking.js do?
ReactFiberMutationTracking.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 ReactFiberMutationTracking.js?
ReactFiberMutationTracking.js defines 4 function(s): popMutationContext, pushMutationContext, pushRootMutationContext, trackHostMutation.
What does ReactFiberMutationTracking.js depend on?
ReactFiberMutationTracking.js imports 1 module(s): ReactFeatureFlags.
What files import ReactFiberMutationTracking.js?
ReactFiberMutationTracking.js is imported by 3 file(s): ReactFiberApplyGesture.js, ReactFiberCommitHostEffects.js, ReactFiberCommitWork.js.
Where is ReactFiberMutationTracking.js in the architecture?
ReactFiberMutationTracking.js is located at packages/react-reconciler/src/ReactFiberMutationTracking.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