Timeline.js — react Source File
Architecture documentation for Timeline.js, a javascript file in the react codebase. 18 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 7fd04d1f_8e14_be78_275b_49d4237a927b["Timeline.js"] 20cc2065_4b5b_fd6b_be12_28f36b0ff4cf["types.js"] 7fd04d1f_8e14_be78_275b_49d4237a927b --> 20cc2065_4b5b_fd6b_be12_28f36b0ff4cf eab2f8f4_2e4c_8e75_87d9_c7d9b524affb["constants.js"] 7fd04d1f_8e14_be78_275b_49d4237a927b --> eab2f8f4_2e4c_8e75_87d9_c7d9b524affb 31154e75_e19d_532b_5417_ac7080d89945["updateColorsToMatchTheme"] 7fd04d1f_8e14_be78_275b_49d4237a927b --> 31154e75_e19d_532b_5417_ac7080d89945 7b213c28_1e91_ab50_3fbc_02eaee967af5["TimelineContext.js"] 7fd04d1f_8e14_be78_275b_49d4237a927b --> 7b213c28_1e91_ab50_3fbc_02eaee967af5 d5e5a241_0d88_22ae_6561_9211ad78e796["CanvasPage.js"] 7fd04d1f_8e14_be78_275b_49d4237a927b --> d5e5a241_0d88_22ae_6561_9211ad78e796 57cdcaba_9376_75d3_1255_5d46c8b071bc["CanvasPage"] 7fd04d1f_8e14_be78_275b_49d4237a927b --> 57cdcaba_9376_75d3_1255_5d46c8b071bc a381d443_cec6_18eb_759f_5d0878906293["timelineCache.js"] 7fd04d1f_8e14_be78_275b_49d4237a927b --> a381d443_cec6_18eb_759f_5d0878906293 e3efee68_a282_ee12_670e_539a11c16f99["TimelineSearchInput.js"] 7fd04d1f_8e14_be78_275b_49d4237a927b --> e3efee68_a282_ee12_670e_539a11c16f99 6966a1b1_9f8d_fe86_8881_3275433175ea["TimelineSearchInput"] 7fd04d1f_8e14_be78_275b_49d4237a927b --> 6966a1b1_9f8d_fe86_8881_3275433175ea af2d2803_cefc_34b0_cb09_2b822b422527["TimelineNotSupported.js"] 7fd04d1f_8e14_be78_275b_49d4237a927b --> af2d2803_cefc_34b0_cb09_2b822b422527 9be1b04a_aeff_a22a_fb97_3032dd5628fc["TimelineNotSupported"] 7fd04d1f_8e14_be78_275b_49d4237a927b --> 9be1b04a_aeff_a22a_fb97_3032dd5628fc f222957d_5161_94da_3126_e94f7f8ded93["TimelineSearchContext.js"] 7fd04d1f_8e14_be78_275b_49d4237a927b --> f222957d_5161_94da_3126_e94f7f8ded93 f0f6f14b_2c45_fafe_38e5_29c40efefe78["Timeline.css"] 7fd04d1f_8e14_be78_275b_49d4237a927b --> f0f6f14b_2c45_fafe_38e5_29c40efefe78 ac587885_e294_a1e9_b13f_5e7b920fdb42["react"] 7fd04d1f_8e14_be78_275b_49d4237a927b --> ac587885_e294_a1e9_b13f_5e7b920fdb42 style 7fd04d1f_8e14_be78_275b_49d4237a927b 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 {ViewState} from './types';
import * as React from 'react';
import {
Suspense,
useContext,
useDeferredValue,
useLayoutEffect,
useRef,
useState,
} from 'react';
import {SettingsContext} from 'react-devtools-shared/src/devtools/views/Settings/SettingsContext';
import {ProfilerContext} from 'react-devtools-shared/src/devtools/views/Profiler/ProfilerContext';
import NoProfilingData from 'react-devtools-shared/src/devtools/views/Profiler/NoProfilingData';
import RecordingInProgress from 'react-devtools-shared/src/devtools/views/Profiler/RecordingInProgress';
import {updateColorsToMatchTheme} from './content-views/constants';
import {TimelineContext} from './TimelineContext';
import CanvasPage from './CanvasPage';
import {importFile} from './timelineCache';
import TimelineSearchInput from './TimelineSearchInput';
import TimelineNotSupported from './TimelineNotSupported';
import {TimelineSearchContextController} from './TimelineSearchContext';
import styles from './Timeline.css';
export function Timeline(_: {}): React.Node {
const {
file,
inMemoryTimelineData,
isPerformanceTracksSupported,
isTimelineSupported,
setFile,
viewState,
} = useContext(TimelineContext);
const {didRecordCommits, isProfiling} = useContext(ProfilerContext);
const ref = useRef(null);
// HACK: Canvas rendering uses an imperative API,
// but DevTools colors are stored in CSS variables (see root.css and SettingsContext).
// When the theme changes, we need to trigger update the imperative colors and re-draw the Canvas.
const {theme} = useContext(SettingsContext);
// HACK: SettingsContext also uses a useLayoutEffect to update styles;
// make sure the theme context in SettingsContext updates before this code.
const deferredTheme = useDeferredValue(theme);
// HACK: Schedule a re-render of the Canvas once colors have been updated.
// The easiest way to guarangee this happens is to recreate the inner Canvas component.
const [key, setKey] = useState<string>(theme);
useLayoutEffect(() => {
const pollForTheme = () => {
if (updateColorsToMatchTheme(((ref.current: any): HTMLDivElement))) {
// ... (117 more lines)
Domain
Subdomains
Dependencies
- CanvasPage
- CanvasPage.js
- NoProfilingData
- ProfilerContext
- RecordingInProgress
- SettingsContext
- Timeline.css
- TimelineContext.js
- TimelineNotSupported
- TimelineNotSupported.js
- TimelineSearchContext.js
- TimelineSearchInput
- TimelineSearchInput.js
- constants.js
- react
- timelineCache.js
- types.js
- updateColorsToMatchTheme
Source
Frequently Asked Questions
What does Timeline.js do?
Timeline.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 Timeline.js?
Timeline.js defines 4 function(s): CouldNotLoadProfile, FileLoader.onFileSelect, NoTimelineData, ProcessingData.
What does Timeline.js depend on?
Timeline.js imports 18 module(s): CanvasPage, CanvasPage.js, NoProfilingData, ProfilerContext, RecordingInProgress, SettingsContext, Timeline.css, TimelineContext.js, and 10 more.
Where is Timeline.js in the architecture?
Timeline.js is located at packages/react-devtools-timeline/src/Timeline.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-devtools-timeline/src).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free