TimelineSearchContext.js — react Source File
Architecture documentation for TimelineSearchContext.js, a javascript file in the react codebase. 3 imports, 3 dependents.
Entity Profile
Dependency Diagram
graph LR f222957d_5161_94da_3126_e94f7f8ded93["TimelineSearchContext.js"] 20cc2065_4b5b_fd6b_be12_28f36b0ff4cf["types.js"] f222957d_5161_94da_3126_e94f7f8ded93 --> 20cc2065_4b5b_fd6b_be12_28f36b0ff4cf d8f20c67_f5fa_0f0a_c967_c41fd9ffce07["ReactTypes"] f222957d_5161_94da_3126_e94f7f8ded93 --> d8f20c67_f5fa_0f0a_c967_c41fd9ffce07 ac587885_e294_a1e9_b13f_5e7b920fdb42["react"] f222957d_5161_94da_3126_e94f7f8ded93 --> ac587885_e294_a1e9_b13f_5e7b920fdb42 d5e5a241_0d88_22ae_6561_9211ad78e796["CanvasPage.js"] d5e5a241_0d88_22ae_6561_9211ad78e796 --> f222957d_5161_94da_3126_e94f7f8ded93 7fd04d1f_8e14_be78_275b_49d4237a927b["Timeline.js"] 7fd04d1f_8e14_be78_275b_49d4237a927b --> f222957d_5161_94da_3126_e94f7f8ded93 e3efee68_a282_ee12_670e_539a11c16f99["TimelineSearchInput.js"] e3efee68_a282_ee12_670e_539a11c16f99 --> f222957d_5161_94da_3126_e94f7f8ded93 style f222957d_5161_94da_3126_e94f7f8ded93 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, useMemo, useReducer} from 'react';
import type {ReactComponentMeasure, TimelineData, ViewState} from './types';
type State = {
profilerData: TimelineData,
searchIndex: number,
searchRegExp: RegExp | null,
searchResults: Array<ReactComponentMeasure>,
searchText: string,
};
type ACTION_GO_TO_NEXT_SEARCH_RESULT = {
type: 'GO_TO_NEXT_SEARCH_RESULT',
};
type ACTION_GO_TO_PREVIOUS_SEARCH_RESULT = {
type: 'GO_TO_PREVIOUS_SEARCH_RESULT',
};
type ACTION_SET_SEARCH_TEXT = {
type: 'SET_SEARCH_TEXT',
payload: string,
};
type Action =
| ACTION_GO_TO_NEXT_SEARCH_RESULT
| ACTION_GO_TO_PREVIOUS_SEARCH_RESULT
| ACTION_SET_SEARCH_TEXT;
type Dispatch = (action: Action) => void;
const EMPTY_ARRAY: Array<ReactComponentMeasure> = [];
function reducer(state: State, action: Action): State {
let {searchIndex, searchRegExp, searchResults, searchText} = state;
switch (action.type) {
case 'GO_TO_NEXT_SEARCH_RESULT':
if (searchResults.length > 0) {
if (searchIndex === -1 || searchIndex + 1 === searchResults.length) {
searchIndex = 0;
} else {
searchIndex++;
}
}
break;
case 'GO_TO_PREVIOUS_SEARCH_RESULT':
if (searchResults.length > 0) {
if (searchIndex === -1 || searchIndex === 0) {
// ... (107 more lines)
Domain
Subdomains
Functions
Dependencies
- ReactTypes
- react
- types.js
Imported By
Source
Frequently Asked Questions
What does TimelineSearchContext.js do?
TimelineSearchContext.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 TimelineSearchContext.js?
TimelineSearchContext.js defines 1 function(s): Dispatch.
What does TimelineSearchContext.js depend on?
TimelineSearchContext.js imports 3 module(s): ReactTypes, react, types.js.
What files import TimelineSearchContext.js?
TimelineSearchContext.js is imported by 3 file(s): CanvasPage.js, Timeline.js, TimelineSearchInput.js.
Where is TimelineSearchContext.js in the architecture?
TimelineSearchContext.js is located at packages/react-devtools-timeline/src/TimelineSearchContext.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