Home / File/ WhatChanged.js — react Source File

WhatChanged.js — react Source File

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

File javascript BabelCompiler Validation 5 imports 2 dependents 1 functions

Entity Profile

Dependency Diagram

graph LR
  5e16f57b_1380_519b_fff9_378869430fab["WhatChanged.js"]
  6c4f87a5_052e_5ad2_3388_1e4392b92a53["ProfilerContext.js"]
  5e16f57b_1380_519b_fff9_378869430fab --> 6c4f87a5_052e_5ad2_3388_1e4392b92a53
  913bb343_55ea_f1b8_08f5_b75cb0a92b76["context.js"]
  5e16f57b_1380_519b_fff9_378869430fab --> 913bb343_55ea_f1b8_08f5_b75cb0a92b76
  3d542635_d0d5_3496_e4b4_c85f0c870c18["WhatChanged.css"]
  5e16f57b_1380_519b_fff9_378869430fab --> 3d542635_d0d5_3496_e4b4_c85f0c870c18
  42ca8057_28d2_de34_4629_6b91b57e8269["HookChangeSummary.js"]
  5e16f57b_1380_519b_fff9_378869430fab --> 42ca8057_28d2_de34_4629_6b91b57e8269
  ac587885_e294_a1e9_b13f_5e7b920fdb42["react"]
  5e16f57b_1380_519b_fff9_378869430fab --> ac587885_e294_a1e9_b13f_5e7b920fdb42
  38d38257_86b3_3154_4c21_7fbaf41be1cb["HoveredFiberInfo.js"]
  38d38257_86b3_3154_4c21_7fbaf41be1cb --> 5e16f57b_1380_519b_fff9_378869430fab
  05d8745f_e91f_f824_2d34_e3be3fd76a6c["SidebarSelectedFiberInfo.js"]
  05d8745f_e91f_f824_2d34_e3be3fd76a6c --> 5e16f57b_1380_519b_fff9_378869430fab
  style 5e16f57b_1380_519b_fff9_378869430fab 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 * as React from 'react';
import {useContext} from 'react';

import {ProfilerContext} from './ProfilerContext';
import {StoreContext} from '../context';

import styles from './WhatChanged.css';
import HookChangeSummary from './HookChangeSummary';

type Props = {
  fiberID: number,
  displayMode?: 'detailed' | 'compact',
};

export default function WhatChanged({
  fiberID,
  displayMode = 'detailed',
}: Props): React.Node {
  const {profilerStore} = useContext(StoreContext);
  const {rootID, selectedCommitIndex} = useContext(ProfilerContext);

  // TRICKY
  // Handle edge case where no commit is selected because of a min-duration filter update.
  // If the commit index is null, suspending for data below would throw an error.
  // TODO (ProfilerContext) This check should not be necessary.
  if (selectedCommitIndex === null) {
    return null;
  }

  const {changeDescriptions} = profilerStore.getCommitData(
    ((rootID: any): number),
    selectedCommitIndex,
  );

  if (changeDescriptions === null) {
    return null;
  }

  const changeDescription = changeDescriptions.get(fiberID);
  if (changeDescription == null) {
    return null;
  }

  const {context, didHooksChange, hooks, isFirstMount, props, state} =
    changeDescription;

  if (isFirstMount) {
    return (
      <div className={styles.Component}>
        <label className={styles.Label}>Why did this render?</label>
        <div className={styles.Item}>
// ... (94 more lines)

Domain

Subdomains

Functions

Frequently Asked Questions

What does WhatChanged.js do?
WhatChanged.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 WhatChanged.js?
WhatChanged.js defines 1 function(s): WhatChanged.
What does WhatChanged.js depend on?
WhatChanged.js imports 5 module(s): HookChangeSummary.js, ProfilerContext.js, WhatChanged.css, context.js, react.
What files import WhatChanged.js?
WhatChanged.js is imported by 2 file(s): HoveredFiberInfo.js, SidebarSelectedFiberInfo.js.
Where is WhatChanged.js in the architecture?
WhatChanged.js is located at packages/react-devtools-shared/src/devtools/views/Profiler/WhatChanged.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-devtools-shared/src/devtools/views/Profiler).

Analyze Your Own Codebase

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

Try Supermodel Free