Home / File/ ReactFlightClientDevToolsHook.js — react Source File

ReactFlightClientDevToolsHook.js — react Source File

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

File javascript BabelCompiler Validation 1 dependents 1 functions

Entity Profile

Dependency Diagram

graph LR
  2795c922_bc1c_8105_46d7_d6274d4e24a9["ReactFlightClientDevToolsHook.js"]
  61eb841d_69e6_7047_22ce_b71bae029dcd["ReactFlightClient.js"]
  61eb841d_69e6_7047_22ce_b71bae029dcd --> 2795c922_bc1c_8105_46d7_d6274d4e24a9
  style 2795c922_bc1c_8105_46d7_d6274d4e24a9 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
 */

declare const __REACT_DEVTOOLS_GLOBAL_HOOK__: Object | void;

export function injectInternals(internals: Object): boolean {
  if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') {
    // No DevTools
    return false;
  }
  const hook = __REACT_DEVTOOLS_GLOBAL_HOOK__;
  if (hook.isDisabled) {
    // This isn't a real property on the hook, but it can be set to opt out
    // of DevTools integration and associated warnings and logs.
    // https://github.com/facebook/react/issues/3877
    return true;
  }
  if (!hook.supportsFlight) {
    // DevTools exists, even though it doesn't support Flight.
    return true;
  }
  try {
    hook.inject(internals);
  } catch (err) {
    // Catch all errors because it is unsafe to throw during initialization.
    if (__DEV__) {
      console.error('React instrumentation encountered an error: %o.', err);
    }
  }
  if (hook.checkDCE) {
    // This is the real DevTools.
    return true;
  } else {
    // This is likely a hook installed by Fast Refresh runtime.
    return false;
  }
}

Domain

Subdomains

Functions

Frequently Asked Questions

What does ReactFlightClientDevToolsHook.js do?
ReactFlightClientDevToolsHook.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 ReactFlightClientDevToolsHook.js?
ReactFlightClientDevToolsHook.js defines 1 function(s): injectInternals.
What files import ReactFlightClientDevToolsHook.js?
ReactFlightClientDevToolsHook.js is imported by 1 file(s): ReactFlightClient.js.
Where is ReactFlightClientDevToolsHook.js in the architecture?
ReactFlightClientDevToolsHook.js is located at packages/react-client/src/ReactFlightClientDevToolsHook.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-client/src).

Analyze Your Own Codebase

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

Try Supermodel Free