hookNamesCache.js — react Source File
Architecture documentation for hookNamesCache.js, a javascript file in the react codebase. 8 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 2e5340ff_c18c_8b58_8a45_86e8bb6884f5["hookNamesCache.js"] 65802b54_1b70_c424_1a67_236a67c06eb1["PerformanceLoggingUtils.js"] 2e5340ff_c18c_8b58_8a45_86e8bb6884f5 --> 65802b54_1b70_c424_1a67_236a67c06eb1 1c1420b7_ac86_a15c_84e2_cc784faf684d["Logger.js"] 2e5340ff_c18c_8b58_8a45_86e8bb6884f5 --> 1c1420b7_ac86_a15c_84e2_cc784faf684d 55d27179_f566_db64_927b_e95655abee00["constants"] 2e5340ff_c18c_8b58_8a45_86e8bb6884f5 --> 55d27179_f566_db64_927b_e95655abee00 741f125f_8d71_2134_c016_a18fb8f60d66["ReactDebugHooks"] 2e5340ff_c18c_8b58_8a45_86e8bb6884f5 --> 741f125f_8d71_2134_c016_a18fb8f60d66 d8f20c67_f5fa_0f0a_c967_c41fd9ffce07["ReactTypes"] 2e5340ff_c18c_8b58_8a45_86e8bb6884f5 --> d8f20c67_f5fa_0f0a_c967_c41fd9ffce07 aec7978f_0a19_ba93_de9e_ac8cf5ddc74b["types"] 2e5340ff_c18c_8b58_8a45_86e8bb6884f5 --> aec7978f_0a19_ba93_de9e_ac8cf5ddc74b 2e5d5bab_71fd_5a80_3fa3_895dcaab6301["FetchFileWithCachingContext"] 2e5340ff_c18c_8b58_8a45_86e8bb6884f5 --> 2e5d5bab_71fd_5a80_3fa3_895dcaab6301 ac587885_e294_a1e9_b13f_5e7b920fdb42["react"] 2e5340ff_c18c_8b58_8a45_86e8bb6884f5 --> ac587885_e294_a1e9_b13f_5e7b920fdb42 style 2e5340ff_c18c_8b58_8a45_86e8bb6884f5 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 {__DEBUG__} from 'react-devtools-shared/src/constants';
import type {HooksTree} from 'react-debug-tools/src/ReactDebugHooks';
import type {
Thenable,
FulfilledThenable,
RejectedThenable,
} from 'shared/ReactTypes';
import type {
Element,
HookNames,
} from 'react-devtools-shared/src/frontend/types';
import type {FetchFileWithCaching} from 'react-devtools-shared/src/devtools/views/Components/FetchFileWithCachingContext';
import * as React from 'react';
import {withCallbackPerfMeasurements} from './PerformanceLoggingUtils';
import {logEvent} from './Logger';
const TIMEOUT = 30000;
function readRecord<T>(record: Thenable<T>): T | null {
if (typeof React.use === 'function') {
try {
// eslint-disable-next-line react-hooks-published/rules-of-hooks
return React.use(record);
} catch (x) {
if (record.status === 'rejected') {
return null;
}
throw x;
}
}
if (record.status === 'fulfilled') {
return record.value;
} else if (record.status === 'rejected') {
return null;
} else {
throw record;
}
}
type LoadHookNamesFunction = (
hookLog: HooksTree,
fetchFileWithCaching: FetchFileWithCaching | null,
) => Thenable<HookNames>;
// This is intentionally a module-level Map, rather than a React-managed one.
// Otherwise, refreshing the inspected element cache would also clear this cache.
// TODO Rethink this if the React API constraints change.
// See https://github.com/reactwg/react-18/discussions/25#discussioncomment-980435
let map: WeakMap<Element, Thenable<HookNames>> = new WeakMap();
// ... (171 more lines)
Domain
Dependencies
- FetchFileWithCachingContext
- Logger.js
- PerformanceLoggingUtils.js
- ReactDebugHooks
- ReactTypes
- constants
- react
- types
Source
Frequently Asked Questions
What does hookNamesCache.js do?
hookNamesCache.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain.
What does hookNamesCache.js depend on?
hookNamesCache.js imports 8 module(s): FetchFileWithCachingContext, Logger.js, PerformanceLoggingUtils.js, ReactDebugHooks, ReactTypes, constants, react, types.
Where is hookNamesCache.js in the architecture?
hookNamesCache.js is located at packages/react-devtools-shared/src/hookNamesCache.js (domain: BabelCompiler, directory: packages/react-devtools-shared/src).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free