Home / File/ ReactFlightCallUserSpace.js — react Source File

ReactFlightCallUserSpace.js — react Source File

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

File javascript BabelCompiler 5 imports 1 dependents

Entity Profile

Dependency Diagram

graph LR
  c7514de5_b740_6b0d_a64b_debd7dc5f1df["ReactFlightCallUserSpace.js"]
  e143ec37_0522_ef26_bb9c_180891985523["ReactFlightServer.js"]
  c7514de5_b740_6b0d_a64b_debd7dc5f1df --> e143ec37_0522_ef26_bb9c_180891985523
  5e4cdebf_06be_91d3_9e4a_8fec8b4e5b2f["ReactFlightCurrentOwner.js"]
  c7514de5_b740_6b0d_a64b_debd7dc5f1df --> 5e4cdebf_06be_91d3_9e4a_8fec8b4e5b2f
  bdb1e368_18d0_ccdd_4189_c8089ac1cef0["setCurrentOwner"]
  c7514de5_b740_6b0d_a64b_debd7dc5f1df --> bdb1e368_18d0_ccdd_4189_c8089ac1cef0
  ebbd7451_c238_0c5d_d01e_21d7c2d60653["ReactLazy"]
  c7514de5_b740_6b0d_a64b_debd7dc5f1df --> ebbd7451_c238_0c5d_d01e_21d7c2d60653
  d8f20c67_f5fa_0f0a_c967_c41fd9ffce07["ReactTypes"]
  c7514de5_b740_6b0d_a64b_debd7dc5f1df --> d8f20c67_f5fa_0f0a_c967_c41fd9ffce07
  e143ec37_0522_ef26_bb9c_180891985523["ReactFlightServer.js"]
  e143ec37_0522_ef26_bb9c_180891985523 --> c7514de5_b740_6b0d_a64b_debd7dc5f1df
  style c7514de5_b740_6b0d_a64b_debd7dc5f1df 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 {LazyComponent} from 'react/src/ReactLazy';

import type {ReactComponentInfo} from 'shared/ReactTypes';

import type {ReactClientValue} from './ReactFlightServer';

import {setCurrentOwner} from './flight/ReactFlightCurrentOwner';

// These indirections exists so we can exclude its stack frame in DEV (and anything below it).
// TODO: Consider marking the whole bundle instead of these boundaries.

const callComponent = {
  react_stack_bottom_frame: function <Props, R>(
    Component: (p: Props, arg: void) => R,
    props: Props,
    componentDebugInfo: ReactComponentInfo,
  ): R {
    // The secondArg is always undefined in Server Components since refs error early.
    const secondArg = undefined;
    setCurrentOwner(componentDebugInfo);
    try {
      return Component(props, secondArg);
    } finally {
      setCurrentOwner(null);
    }
  },
};

export const callComponentInDEV: <Props, R>(
  Component: (p: Props, arg: void) => R,
  props: Props,
  componentDebugInfo: ReactComponentInfo,
) => R = __DEV__
  ? // We use this technique to trick minifiers to preserve the function name.
    (callComponent.react_stack_bottom_frame.bind(callComponent): any)
  : (null: any);

const callLazyInit = {
  react_stack_bottom_frame: function (lazy: LazyComponent<any, any>): any {
    const payload = lazy._payload;
    const init = lazy._init;
    return init(payload);
  },
};

export const callLazyInitInDEV: (lazy: LazyComponent<any, any>) => any = __DEV__
  ? // We use this technique to trick minifiers to preserve the function name.
    (callLazyInit.react_stack_bottom_frame.bind(callLazyInit): any)
  : (null: any);

const callIterator = {
  react_stack_bottom_frame: function (
    iterator: $AsyncIterator<ReactClientValue, ReactClientValue, void>,
    progress: (
      entry:
        | {done: false, +value: ReactClientValue, ...}
        | {done: true, +value: ReactClientValue, ...},
    ) => void,
    error: (reason: mixed) => void,
  ): void {
    iterator.next().then(progress, error);
  },
};

export const callIteratorInDEV: (
  iterator: $AsyncIterator<ReactClientValue, ReactClientValue, void>,
  progress: (
    entry:
      | {done: false, +value: ReactClientValue, ...}
      | {done: true, +value: ReactClientValue, ...},
  ) => void,
  error: (reason: mixed) => void,
) => void = __DEV__
  ? // We use this technique to trick minifiers to preserve the function name.
    (callIterator.react_stack_bottom_frame.bind(callIterator): any)
  : (null: any);

Domain

Frequently Asked Questions

What does ReactFlightCallUserSpace.js do?
ReactFlightCallUserSpace.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain.
What does ReactFlightCallUserSpace.js depend on?
ReactFlightCallUserSpace.js imports 5 module(s): ReactFlightCurrentOwner.js, ReactFlightServer.js, ReactLazy, ReactTypes, setCurrentOwner.
What files import ReactFlightCallUserSpace.js?
ReactFlightCallUserSpace.js is imported by 1 file(s): ReactFlightServer.js.
Where is ReactFlightCallUserSpace.js in the architecture?
ReactFlightCallUserSpace.js is located at packages/react-server/src/ReactFlightCallUserSpace.js (domain: BabelCompiler, directory: packages/react-server/src).

Analyze Your Own Codebase

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

Try Supermodel Free