Home / File/ OpenInEditorButton.js — react Source File

OpenInEditorButton.js — react Source File

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

File javascript BabelCompiler Validation 7 imports 1 dependents 2 functions

Entity Profile

Dependency Diagram

graph LR
  b5bf8091_2b63_1c9d_a667_8b4f387e11b9["OpenInEditorButton.js"]
  df34d6bc_88ee_9d70_cb1b_fbe686dca6da["utils.js"]
  b5bf8091_2b63_1c9d_a667_8b4f387e11b9 --> df34d6bc_88ee_9d70_cb1b_fbe686dca6da
  3c81519b_a855_b45e_b91b_c1dcaaf5d5b9["checkConditions"]
  b5bf8091_2b63_1c9d_a667_8b4f387e11b9 --> 3c81519b_a855_b45e_b91b_c1dcaaf5d5b9
  ac587885_e294_a1e9_b13f_5e7b920fdb42["react"]
  b5bf8091_2b63_1c9d_a667_8b4f387e11b9 --> ac587885_e294_a1e9_b13f_5e7b920fdb42
  e990a84d_b490_703b_26b3_fe044fc7bcf3["Button"]
  b5bf8091_2b63_1c9d_a667_8b4f387e11b9 --> e990a84d_b490_703b_26b3_fe044fc7bcf3
  0cbf34b0_8358_799e_95fa_64745d5111eb["ButtonIcon"]
  b5bf8091_2b63_1c9d_a667_8b4f387e11b9 --> 0cbf34b0_8358_799e_95fa_64745d5111eb
  d8f20c67_f5fa_0f0a_c967_c41fd9ffce07["ReactTypes"]
  b5bf8091_2b63_1c9d_a667_8b4f387e11b9 --> d8f20c67_f5fa_0f0a_c967_c41fd9ffce07
  c3870ba8_6512_a088_2557_ff78b3a22e41["symbolicateSource"]
  b5bf8091_2b63_1c9d_a667_8b4f387e11b9 --> c3870ba8_6512_a088_2557_ff78b3a22e41
  4c0d725a_27bd_a723_3599_a3e75bea5bd3["InspectedElement.js"]
  4c0d725a_27bd_a723_3599_a3e75bea5bd3 --> b5bf8091_2b63_1c9d_a667_8b4f387e11b9
  style b5bf8091_2b63_1c9d_a667_8b4f387e11b9 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 Button from 'react-devtools-shared/src/devtools/views/Button';
import ButtonIcon from 'react-devtools-shared/src/devtools/views/ButtonIcon';

import type {ReactFunctionLocation} from 'shared/ReactTypes';
import type {SourceMappedLocation} from 'react-devtools-shared/src/symbolicateSource';

import {checkConditions} from '../Editor/utils';

type Props = {
  editorURL: string,
  source: ReactFunctionLocation,
  symbolicatedSourcePromise: Promise<SourceMappedLocation | null>,
};

function OpenSymbolicatedSourceInEditorButton({
  editorURL,
  source,
  symbolicatedSourcePromise,
}: Props): React.Node {
  const symbolicatedSource = React.use(symbolicatedSourcePromise);

  const {url, shouldDisableButton} = checkConditions(
    editorURL,
    symbolicatedSource ? symbolicatedSource.location : source,
  );

  return (
    <Button
      disabled={shouldDisableButton}
      onClick={() => window.open(url)}
      title="Open in editor">
      <ButtonIcon type="editor" />
    </Button>
  );
}

function OpenInEditorButton(props: Props): React.Node {
  return (
    <React.Suspense
      fallback={
        <Button disabled={true} title="retrieving original source…">
          <ButtonIcon type="editor" />
        </Button>
      }>
      <OpenSymbolicatedSourceInEditorButton {...props} />
    </React.Suspense>
  );
}

export default OpenInEditorButton;

Domain

Subdomains

Dependencies

Frequently Asked Questions

What does OpenInEditorButton.js do?
OpenInEditorButton.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 OpenInEditorButton.js?
OpenInEditorButton.js defines 2 function(s): OpenInEditorButton, OpenSymbolicatedSourceInEditorButton.
What does OpenInEditorButton.js depend on?
OpenInEditorButton.js imports 7 module(s): Button, ButtonIcon, ReactTypes, checkConditions, react, symbolicateSource, utils.js.
What files import OpenInEditorButton.js?
OpenInEditorButton.js is imported by 1 file(s): InspectedElement.js.
Where is OpenInEditorButton.js in the architecture?
OpenInEditorButton.js is located at packages/react-devtools-shared/src/devtools/views/Components/OpenInEditorButton.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-devtools-shared/src/devtools/views/Components).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free