Home / File/ ProfilerContext.js — react Source File

ProfilerContext.js — react Source File

Architecture documentation for ProfilerContext.js, a javascript file in the react codebase. 9 imports, 14 dependents.

File javascript BabelCompiler 9 imports 14 dependents

Entity Profile

Dependency Diagram

graph LR
  6c4f87a5_052e_5ad2_3388_1e4392b92a53["ProfilerContext.js"]
  315baf50_1028_51ca_a9c1_679c6a17ed98["hooks.js"]
  6c4f87a5_052e_5ad2_3388_1e4392b92a53 --> 315baf50_1028_51ca_a9c1_679c6a17ed98
  2d59b0f9_9ad6_da4d_0264_d98f193ab3fd["TreeContext.js"]
  6c4f87a5_052e_5ad2_3388_1e4392b92a53 --> 2d59b0f9_9ad6_da4d_0264_d98f193ab3fd
  913bb343_55ea_f1b8_08f5_b75cb0a92b76["context.js"]
  6c4f87a5_052e_5ad2_3388_1e4392b92a53 --> 913bb343_55ea_f1b8_08f5_b75cb0a92b76
  1d558132_0276_7e48_1a18_611bb9fef088["useCommitFilteringAndNavigation.js"]
  6c4f87a5_052e_5ad2_3388_1e4392b92a53 --> 1d558132_0276_7e48_1a18_611bb9fef088
  e24e0e52_ceca_3aad_8962_b582af497d29["useCommitFilteringAndNavigation"]
  6c4f87a5_052e_5ad2_3388_1e4392b92a53 --> e24e0e52_ceca_3aad_8962_b582af497d29
  98e7cbed_f4b4_9f35_838e_6e7cf3e5edcf["types.js"]
  6c4f87a5_052e_5ad2_3388_1e4392b92a53 --> 98e7cbed_f4b4_9f35_838e_6e7cf3e5edcf
  d8f20c67_f5fa_0f0a_c967_c41fd9ffce07["ReactTypes"]
  6c4f87a5_052e_5ad2_3388_1e4392b92a53 --> d8f20c67_f5fa_0f0a_c967_c41fd9ffce07
  ac587885_e294_a1e9_b13f_5e7b920fdb42["react"]
  6c4f87a5_052e_5ad2_3388_1e4392b92a53 --> ac587885_e294_a1e9_b13f_5e7b920fdb42
  2b832bf7_5b5b_7f08_2faa_1e7c8d8acc6d["Logger"]
  6c4f87a5_052e_5ad2_3388_1e4392b92a53 --> 2b832bf7_5b5b_7f08_2faa_1e7c8d8acc6d
  e2c52a93_982e_407f_9fee_e89aa134ae9d["DevTools.js"]
  e2c52a93_982e_407f_9fee_e89aa134ae9d --> 6c4f87a5_052e_5ad2_3388_1e4392b92a53
  e7351d91_39f5_aa1e_7502_e96f037bd3e3["ClearProfilingDataButton.js"]
  e7351d91_39f5_aa1e_7502_e96f037bd3e3 --> 6c4f87a5_052e_5ad2_3388_1e4392b92a53
  54e7a598_e83a_4b14_3104_1fa62a034c31["CommitFlamegraph.js"]
  54e7a598_e83a_4b14_3104_1fa62a034c31 --> 6c4f87a5_052e_5ad2_3388_1e4392b92a53
  0ad6c6d5_5d6d_2d8a_d957_e1433af66ea0["CommitRanked.js"]
  0ad6c6d5_5d6d_2d8a_d957_e1433af66ea0 --> 6c4f87a5_052e_5ad2_3388_1e4392b92a53
  38d38257_86b3_3154_4c21_7fbaf41be1cb["HoveredFiberInfo.js"]
  38d38257_86b3_3154_4c21_7fbaf41be1cb --> 6c4f87a5_052e_5ad2_3388_1e4392b92a53
  style 6c4f87a5_052e_5ad2_3388_1e4392b92a53 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 {ReactContext} from 'shared/ReactTypes';

import * as React from 'react';
import {
  createContext,
  useCallback,
  useContext,
  useMemo,
  useState,
  useEffect,
} from 'react';
import {useLocalStorage, useSubscription} from '../hooks';
import {
  TreeDispatcherContext,
  TreeStateContext,
} from '../Components/TreeContext';
import {StoreContext} from '../context';
import {logEvent} from 'react-devtools-shared/src/Logger';
import {useCommitFilteringAndNavigation} from './useCommitFilteringAndNavigation';

import type {CommitDataFrontend, ProfilingDataFrontend} from './types';

export type TabID = 'flame-chart' | 'ranked-chart' | 'timeline';

export type Context = {
  // Which tab is selected in the Profiler UI?
  selectedTabID: TabID,
  selectTab(id: TabID): void,

  // Store subscription based values.
  // The isProfiling value may be modified by the record button in the Profiler toolbar,
  // or from the backend itself (after a reload-and-profile action).
  // It is synced between the backend and frontend via a Store subscription.
  didRecordCommits: boolean,
  isProcessingData: boolean,
  isProfiling: boolean,
  profilingData: ProfilingDataFrontend | null,
  startProfiling(): void,
  stopProfiling(): void,
  supportsProfiling: boolean,

  // Which root should profiling data be shown for?
  // This value should be initialized to either:
  // 1. The selected root in the Components tree (if it has any profiling data) or
  // 2. The first root in the list with profiling data.
  rootID: number | null,
  setRootID: (id: number) => void,

  // Controls whether commits are filtered by duration.
  // This value is controlled by a filter toggle UI in the Profiler toolbar.
  // It impacts the commit selector UI as well as the fiber commits bar chart.
// ... (294 more lines)

Domain

Frequently Asked Questions

What does ProfilerContext.js do?
ProfilerContext.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain.
What does ProfilerContext.js depend on?
ProfilerContext.js imports 9 module(s): Logger, ReactTypes, TreeContext.js, context.js, hooks.js, react, types.js, useCommitFilteringAndNavigation, and 1 more.
What files import ProfilerContext.js?
ProfilerContext.js is imported by 14 file(s): ClearProfilingDataButton.js, CommitFlamegraph.js, CommitRanked.js, DevTools.js, HoveredFiberInfo.js, Profiler.js, ProfilingImportExportButtons.js, RecordToggle.js, and 6 more.
Where is ProfilerContext.js in the architecture?
ProfilerContext.js is located at packages/react-devtools-shared/src/devtools/views/Profiler/ProfilerContext.js (domain: BabelCompiler, 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