Home / File/ ClearProfilingDataButton.js — react Source File

ClearProfilingDataButton.js — react Source File

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

File javascript BabelCompiler Validation 8 imports 1 dependents 1 functions

Entity Profile

Dependency Diagram

graph LR
  e7351d91_39f5_aa1e_7502_e96f037bd3e3["ClearProfilingDataButton.js"]
  6c4f87a5_052e_5ad2_3388_1e4392b92a53["ProfilerContext.js"]
  e7351d91_39f5_aa1e_7502_e96f037bd3e3 --> 6c4f87a5_052e_5ad2_3388_1e4392b92a53
  f9049b08_60f8_abce_a6a6_153f88447124["Button.js"]
  e7351d91_39f5_aa1e_7502_e96f037bd3e3 --> f9049b08_60f8_abce_a6a6_153f88447124
  f71ee326_17f0_7db4_4178_2763fb1c2ad1["Button"]
  e7351d91_39f5_aa1e_7502_e96f037bd3e3 --> f71ee326_17f0_7db4_4178_2763fb1c2ad1
  9f39024f_b905_9b0f_2fc7_e24785732638["ButtonIcon.js"]
  e7351d91_39f5_aa1e_7502_e96f037bd3e3 --> 9f39024f_b905_9b0f_2fc7_e24785732638
  4690d9c0_cb81_9593_7817_f9e61a49f9e7["ButtonIcon"]
  e7351d91_39f5_aa1e_7502_e96f037bd3e3 --> 4690d9c0_cb81_9593_7817_f9e61a49f9e7
  913bb343_55ea_f1b8_08f5_b75cb0a92b76["context.js"]
  e7351d91_39f5_aa1e_7502_e96f037bd3e3 --> 913bb343_55ea_f1b8_08f5_b75cb0a92b76
  ac587885_e294_a1e9_b13f_5e7b920fdb42["react"]
  e7351d91_39f5_aa1e_7502_e96f037bd3e3 --> ac587885_e294_a1e9_b13f_5e7b920fdb42
  02511792_3032_82be_67ac_e8a3f9d19220["TimelineContext"]
  e7351d91_39f5_aa1e_7502_e96f037bd3e3 --> 02511792_3032_82be_67ac_e8a3f9d19220
  2e59ff66_9c56_6e37_8843_8e474e6b0d70["Profiler.js"]
  2e59ff66_9c56_6e37_8843_8e474e6b0d70 --> e7351d91_39f5_aa1e_7502_e96f037bd3e3
  style e7351d91_39f5_aa1e_7502_e96f037bd3e3 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 Button from '../Button';
import ButtonIcon from '../ButtonIcon';
import {StoreContext} from '../context';
import {TimelineContext} from 'react-devtools-timeline/src/TimelineContext';

export default function ClearProfilingDataButton(): React.Node {
  const store = useContext(StoreContext);
  const {didRecordCommits, isProfiling} = useContext(ProfilerContext);
  const {file, setFile} = useContext(TimelineContext);
  const {profilerStore} = store;

  const doesHaveInMemoryData = didRecordCommits;
  const doesHaveUserTimingData = file !== null;

  const clear = () => {
    if (doesHaveInMemoryData) {
      profilerStore.clear();
    }
    if (doesHaveUserTimingData) {
      setFile(null);
    }
  };

  return (
    <Button
      disabled={
        isProfiling || !(doesHaveInMemoryData || doesHaveUserTimingData)
      }
      onClick={clear}
      title="Clear profiling data">
      <ButtonIcon type="clear" />
    </Button>
  );
}

Domain

Subdomains

Frequently Asked Questions

What does ClearProfilingDataButton.js do?
ClearProfilingDataButton.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 ClearProfilingDataButton.js?
ClearProfilingDataButton.js defines 1 function(s): ClearProfilingDataButton.
What does ClearProfilingDataButton.js depend on?
ClearProfilingDataButton.js imports 8 module(s): Button, Button.js, ButtonIcon, ButtonIcon.js, ProfilerContext.js, TimelineContext, context.js, react.
What files import ClearProfilingDataButton.js?
ClearProfilingDataButton.js is imported by 1 file(s): Profiler.js.
Where is ClearProfilingDataButton.js in the architecture?
ClearProfilingDataButton.js is located at packages/react-devtools-shared/src/devtools/views/Profiler/ClearProfilingDataButton.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