Home / File/ ReactStrictModeWarnings.js — react Source File

ReactStrictModeWarnings.js — react Source File

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

File javascript BabelCompiler Validation 4 imports 3 dependents 2 functions

Entity Profile

Dependency Diagram

graph LR
  95cbada5_3ad8_e19b_606d_d87294fdf73d["ReactStrictModeWarnings.js"]
  6b9f5caa_fb13_3d3c_2f60_ad3c4f58371f["ReactInternalTypes.js"]
  95cbada5_3ad8_e19b_606d_d87294fdf73d --> 6b9f5caa_fb13_3d3c_2f60_ad3c4f58371f
  c115f947_44f7_8d77_0323_1e260644c151["ReactCurrentFiber.js"]
  95cbada5_3ad8_e19b_606d_d87294fdf73d --> c115f947_44f7_8d77_0323_1e260644c151
  da3c54a1_3083_4820_c4b4_b893d0987ccb["ReactTypeOfMode.js"]
  95cbada5_3ad8_e19b_606d_d87294fdf73d --> da3c54a1_3083_4820_c4b4_b893d0987ccb
  6f207e69_195c_8592_d157_684fe7967d1f["getComponentNameFromFiber"]
  95cbada5_3ad8_e19b_606d_d87294fdf73d --> 6f207e69_195c_8592_d157_684fe7967d1f
  0be70812_cc0c_b210_f84f_8e61dd5f831c["ReactFiberBeginWork.js"]
  0be70812_cc0c_b210_f84f_8e61dd5f831c --> 95cbada5_3ad8_e19b_606d_d87294fdf73d
  3805476a_1924_0e35_fff7_6afad197a523["ReactFiberClassComponent.js"]
  3805476a_1924_0e35_fff7_6afad197a523 --> 95cbada5_3ad8_e19b_606d_d87294fdf73d
  d73e9290_2d2e_5d3f_97dd_84929f205c77["ReactFiberWorkLoop.js"]
  d73e9290_2d2e_5d3f_97dd_84929f205c77 --> 95cbada5_3ad8_e19b_606d_d87294fdf73d
  style 95cbada5_3ad8_e19b_606d_d87294fdf73d 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 {runWithFiberInDEV} from './ReactCurrentFiber';
import getComponentNameFromFiber from 'react-reconciler/src/getComponentNameFromFiber';
import {StrictLegacyMode} from './ReactTypeOfMode';

type FiberArray = Array<Fiber>;
type FiberToFiberComponentsMap = Map<Fiber, FiberArray>;

const ReactStrictModeWarnings = {
  recordUnsafeLifecycleWarnings: (fiber: Fiber, instance: any): void => {},
  flushPendingUnsafeLifecycleWarnings: (): void => {},
  recordLegacyContextWarning: (fiber: Fiber, instance: any): void => {},
  flushLegacyContextWarning: (): void => {},
  discardPendingWarnings: (): void => {},
};

if (__DEV__) {
  const findStrictRoot = (fiber: Fiber): Fiber | null => {
    let maybeStrictRoot = null;

    let node: null | Fiber = fiber;
    while (node !== null) {
      if (node.mode & StrictLegacyMode) {
        maybeStrictRoot = node;
      }
      node = node.return;
    }

    return maybeStrictRoot;
  };

  const setToSortedString = (set: Set<string>) => {
    const array = [];
    set.forEach(value => {
      array.push(value);
    });
    return array.sort().join(', ');
  };

  let pendingComponentWillMountWarnings: Array<Fiber> = [];
  let pendingUNSAFE_ComponentWillMountWarnings: Array<Fiber> = [];
  let pendingComponentWillReceivePropsWarnings: Array<Fiber> = [];
  let pendingUNSAFE_ComponentWillReceivePropsWarnings: Array<Fiber> = [];
  let pendingComponentWillUpdateWarnings: Array<Fiber> = [];
  let pendingUNSAFE_ComponentWillUpdateWarnings: Array<Fiber> = [];

  // Tracks components we have already warned about.
  const didWarnAboutUnsafeLifecycles = new Set<mixed>();

  ReactStrictModeWarnings.recordUnsafeLifecycleWarnings = (
// ... (305 more lines)

Domain

Subdomains

Dependencies

Frequently Asked Questions

What does ReactStrictModeWarnings.js do?
ReactStrictModeWarnings.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 ReactStrictModeWarnings.js?
ReactStrictModeWarnings.js defines 2 function(s): ReactStrictModeWarnings, setToSortedString.
What does ReactStrictModeWarnings.js depend on?
ReactStrictModeWarnings.js imports 4 module(s): ReactCurrentFiber.js, ReactInternalTypes.js, ReactTypeOfMode.js, getComponentNameFromFiber.
What files import ReactStrictModeWarnings.js?
ReactStrictModeWarnings.js is imported by 3 file(s): ReactFiberBeginWork.js, ReactFiberClassComponent.js, ReactFiberWorkLoop.js.
Where is ReactStrictModeWarnings.js in the architecture?
ReactStrictModeWarnings.js is located at packages/react-reconciler/src/ReactStrictModeWarnings.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