cache.js — react Source File
Architecture documentation for cache.js, a javascript file in the react codebase. 3 imports, 1 dependents.
Entity Profile
Dependency Diagram
graph LR 99dfcde4_28a9_2198_26a1_c1058b545aea["cache.js"] d067b1e9_9f13_57c9_0078_2aca2499fb52["githubAPI.js"] 99dfcde4_28a9_2198_26a1_c1058b545aea --> d067b1e9_9f13_57c9_0078_2aca2499fb52 d8f20c67_f5fa_0f0a_c967_c41fd9ffce07["ReactTypes"] 99dfcde4_28a9_2198_26a1_c1058b545aea --> d8f20c67_f5fa_0f0a_c967_c41fd9ffce07 ac587885_e294_a1e9_b13f_5e7b920fdb42["react"] 99dfcde4_28a9_2198_26a1_c1058b545aea --> ac587885_e294_a1e9_b13f_5e7b920fdb42 632dd028_efe6_3846_30ed_2eaf83829007["SuspendingErrorView.js"] 632dd028_efe6_3846_30ed_2eaf83829007 --> 99dfcde4_28a9_2198_26a1_c1058b545aea style 99dfcde4_28a9_2198_26a1_c1058b545aea 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 {
Thenable,
FulfilledThenable,
RejectedThenable,
} from 'shared/ReactTypes';
import type {GitHubIssue} from './githubAPI';
import * as React from 'react';
import {unstable_getCacheForType as getCacheForType} from 'react';
import {searchGitHubIssues} from './githubAPI';
const API_TIMEOUT = 3000;
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 (x === null) {
return null;
}
throw x;
}
}
if (record.status === 'fulfilled') {
return record.value;
} else if (record.status === 'rejected') {
return null;
} else {
throw record;
}
}
type GitHubIssueMap = Map<string, Thenable<GitHubIssue>>;
function createMap(): GitHubIssueMap {
return new Map();
}
function getRecordMap(): Map<string, Thenable<GitHubIssue>> {
return getCacheForType(createMap);
}
export function findGitHubIssue(errorMessage: string): GitHubIssue | null {
errorMessage = normalizeErrorMessage(errorMessage);
const map = getRecordMap();
let record = map.get(errorMessage);
if (!record) {
// ... (80 more lines)
Domain
Dependencies
- ReactTypes
- githubAPI.js
- react
Source
Frequently Asked Questions
What does cache.js do?
cache.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain.
What does cache.js depend on?
cache.js imports 3 module(s): ReactTypes, githubAPI.js, react.
What files import cache.js?
cache.js is imported by 1 file(s): SuspendingErrorView.js.
Where is cache.js in the architecture?
cache.js is located at packages/react-devtools-shared/src/devtools/views/ErrorBoundary/cache.js (domain: BabelCompiler, directory: packages/react-devtools-shared/src/devtools/views/ErrorBoundary).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free