Home / File/ inspectedElementCache.js — react Source File

inspectedElementCache.js — react Source File

Architecture documentation for inspectedElementCache.js, a javascript file in the react codebase. 7 imports, 1 dependents.

File javascript BabelCompiler 7 imports 1 dependents

Entity Profile

Dependency Diagram

graph LR
  6bac32d3_6539_c154_fc1b_37182f68d9ed["inspectedElementCache.js"]
  ac587885_e294_a1e9_b13f_5e7b920fdb42["react"]
  6bac32d3_6539_c154_fc1b_37182f68d9ed --> ac587885_e294_a1e9_b13f_5e7b920fdb42
  baf70b0e_4867_b3ed_962a_e5c9ae820fef["store"]
  6bac32d3_6539_c154_fc1b_37182f68d9ed --> baf70b0e_4867_b3ed_962a_e5c9ae820fef
  6a1d42cd_6ed5_9233_85c2_2d89ba596cc7["inspectedElementMutableSource"]
  6bac32d3_6539_c154_fc1b_37182f68d9ed --> 6a1d42cd_6ed5_9233_85c2_2d89ba596cc7
  db3cf1a7_2c71_237e_cabc_4d23159f892b["ElementPollingCancellationError"]
  6bac32d3_6539_c154_fc1b_37182f68d9ed --> db3cf1a7_2c71_237e_cabc_4d23159f892b
  4077b620_5c59_61c2_0910_273f565da757["bridge"]
  6bac32d3_6539_c154_fc1b_37182f68d9ed --> 4077b620_5c59_61c2_0910_273f565da757
  d8f20c67_f5fa_0f0a_c967_c41fd9ffce07["ReactTypes"]
  6bac32d3_6539_c154_fc1b_37182f68d9ed --> d8f20c67_f5fa_0f0a_c967_c41fd9ffce07
  aec7978f_0a19_ba93_de9e_ac8cf5ddc74b["types"]
  6bac32d3_6539_c154_fc1b_37182f68d9ed --> aec7978f_0a19_ba93_de9e_ac8cf5ddc74b
  8d1aac2b_7bad_9e53_cab3_6414b0d9e4c5["InspectedElementErrorBoundary.js"]
  8d1aac2b_7bad_9e53_cab3_6414b0d9e4c5 --> 6bac32d3_6539_c154_fc1b_37182f68d9ed
  style 6bac32d3_6539_c154_fc1b_37182f68d9ed 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 * as React from 'react';

import {
  unstable_getCacheForType as getCacheForType,
  startTransition,
} from 'react';
import Store from 'react-devtools-shared/src/devtools/store';
import {inspectElement as inspectElementMutableSource} from 'react-devtools-shared/src/inspectedElementMutableSource';
import ElementPollingCancellationError from 'react-devtools-shared/src//errors/ElementPollingCancellationError';

import type {FrontendBridge} from 'react-devtools-shared/src/bridge';
import type {
  Thenable,
  FulfilledThenable,
  RejectedThenable,
} from 'shared/ReactTypes';
import type {
  Element,
  InspectedElement as InspectedElementFrontend,
  InspectedElementResponseType,
  InspectedElementPath,
} from 'react-devtools-shared/src/frontend/types';

function readRecord<T>(record: Thenable<T>): T {
  if (typeof React.use === 'function') {
    // eslint-disable-next-line react-hooks-published/rules-of-hooks
    return React.use(record);
  }
  if (record.status === 'fulfilled') {
    return record.value;
  } else if (record.status === 'rejected') {
    throw record.reason;
  } else {
    throw record;
  }
}

type InspectedElementMap = WeakMap<Element, Thenable<InspectedElementFrontend>>;
type CacheSeedKey = () => InspectedElementMap;

function createMap(): InspectedElementMap {
  return new WeakMap();
}

function getRecordMap(): WeakMap<Element, Thenable<InspectedElementFrontend>> {
  return getCacheForType(createMap);
}

function createCacheSeed(
  element: Element,
  inspectedElement: InspectedElementFrontend,
// ... (235 more lines)

Domain

Dependencies

  • ElementPollingCancellationError
  • ReactTypes
  • bridge
  • inspectedElementMutableSource
  • react
  • store
  • types

Frequently Asked Questions

What does inspectedElementCache.js do?
inspectedElementCache.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain.
What does inspectedElementCache.js depend on?
inspectedElementCache.js imports 7 module(s): ElementPollingCancellationError, ReactTypes, bridge, inspectedElementMutableSource, react, store, types.
What files import inspectedElementCache.js?
inspectedElementCache.js is imported by 1 file(s): InspectedElementErrorBoundary.js.
Where is inspectedElementCache.js in the architecture?
inspectedElementCache.js is located at packages/react-devtools-shared/src/inspectedElementCache.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