Home / File/ ReactFlightServerTemporaryReferences.js — react Source File

ReactFlightServerTemporaryReferences.js — react Source File

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

File javascript BabelCompiler Validation 2 dependents 2 functions

Entity Profile

Dependency Diagram

graph LR
  749d7b5e_3580_d461_8c23_23cf2585bd8e["ReactFlightServerTemporaryReferences.js"]
  99eaa032_70fb_6638_05e7_4d3f46e29df3["ReactFlightReplyServer.js"]
  99eaa032_70fb_6638_05e7_4d3f46e29df3 --> 749d7b5e_3580_d461_8c23_23cf2585bd8e
  e143ec37_0522_ef26_bb9c_180891985523["ReactFlightServer.js"]
  e143ec37_0522_ef26_bb9c_180891985523 --> 749d7b5e_3580_d461_8c23_23cf2585bd8e
  style 749d7b5e_3580_d461_8c23_23cf2585bd8e 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
 */

const TEMPORARY_REFERENCE_TAG = Symbol.for('react.temporary.reference');

export opaque type TemporaryReferenceSet = WeakMap<
  TemporaryReference<any>,
  string,
>;

// eslint-disable-next-line no-unused-vars
export interface TemporaryReference<T> {}

export function createTemporaryReferenceSet(): TemporaryReferenceSet {
  return new WeakMap();
}

export function isOpaqueTemporaryReference(reference: Object): boolean {
  return reference.$$typeof === TEMPORARY_REFERENCE_TAG;
}

export function resolveTemporaryReference<T>(
  temporaryReferences: TemporaryReferenceSet,
  temporaryReference: TemporaryReference<T>,
): void | string {
  return temporaryReferences.get(temporaryReference);
}

const proxyHandlers: Proxy$traps<mixed> = {
  get: function (
    target: Function,
    name: string | symbol,
    receiver: Proxy<Function>,
  ) {
    switch (name) {
      // These names are read by the Flight runtime if you end up using the exports object.
      case '$$typeof':
        // These names are a little too common. We should probably have a way to
        // have the Flight runtime extract the inner target instead.
        return target.$$typeof;
      case 'name':
        return undefined;
      case 'displayName':
        return undefined;
      // We need to special case this because createElement reads it if we pass this
      // reference.
      case 'defaultProps':
        return undefined;
      // React looks for debugInfo on thenables.
      case '_debugInfo':
        return undefined;
      // Avoid this attempting to be serialized.
      case 'toJSON':
        return undefined;
// ... (62 more lines)

Domain

Subdomains

Frequently Asked Questions

What does ReactFlightServerTemporaryReferences.js do?
ReactFlightServerTemporaryReferences.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 ReactFlightServerTemporaryReferences.js?
ReactFlightServerTemporaryReferences.js defines 2 function(s): createTemporaryReferenceSet, isOpaqueTemporaryReference.
What files import ReactFlightServerTemporaryReferences.js?
ReactFlightServerTemporaryReferences.js is imported by 2 file(s): ReactFlightReplyServer.js, ReactFlightServer.js.
Where is ReactFlightServerTemporaryReferences.js in the architecture?
ReactFlightServerTemporaryReferences.js is located at packages/react-server/src/ReactFlightServerTemporaryReferences.js (domain: BabelCompiler, subdomain: Validation, 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