Home / File/ ReactCacheClient.js — react Source File

ReactCacheClient.js — react Source File

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

File javascript BabelCompiler Validation 2 imports 1 dependents 1 functions

Entity Profile

Dependency Diagram

graph LR
  865f2152_61bc_2047_c4c5_db8102359517["ReactCacheClient.js"]
  a80e15dd_1ae3_bdaf_0881_b1db10f190ca["ReactCacheImpl.js"]
  865f2152_61bc_2047_c4c5_db8102359517 --> a80e15dd_1ae3_bdaf_0881_b1db10f190ca
  8344de1b_978c_be0f_eebd_38ccc4962a93["ReactFeatureFlags"]
  865f2152_61bc_2047_c4c5_db8102359517 --> 8344de1b_978c_be0f_eebd_38ccc4962a93
  ffdf54f0_7e34_f1e9_1504_9dbadb0fbac5["ReactClient.js"]
  ffdf54f0_7e34_f1e9_1504_9dbadb0fbac5 --> 865f2152_61bc_2047_c4c5_db8102359517
  style 865f2152_61bc_2047_c4c5_db8102359517 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

/**
 * Copyright (c) Meta Platforms, Inc. and its 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 {disableClientCache} from 'shared/ReactFeatureFlags';
import {
  cache as cacheImpl,
  cacheSignal as cacheSignalImpl,
} from './ReactCacheImpl';

function noopCache<A: Iterable<mixed>, T>(fn: (...A) => T): (...A) => T {
  // On the client (i.e. not a Server Components environment) `cache` has
  // no caching behavior. We just return the function as-is.
  //
  // We intend to implement client caching in a future major release. In the
  // meantime, it's only exposed as an API so that Shared Components can use
  // per-request caching on the server without breaking on the client. But it
  // does mean they need to be aware of the behavioral difference.
  //
  // The rest of the behavior is the same as the server implementation — it
  // returns a new reference, extra properties like `displayName` are not
  // preserved, the length of the new function is 0, etc. That way apps can't
  // accidentally depend on those details.
  return function () {
    // $FlowFixMe[incompatible-call]: We don't want to use rest arguments since we transpile the code.
    return fn.apply(null, arguments);
  };
}

export const cache: typeof noopCache = disableClientCache
  ? noopCache
  : cacheImpl;

function noopCacheSignal(): null | AbortSignal {
  return null;
}

export const cacheSignal: () => null | AbortSignal = disableClientCache
  ? noopCacheSignal
  : cacheSignalImpl;

Domain

Subdomains

Functions

Dependencies

Frequently Asked Questions

What does ReactCacheClient.js do?
ReactCacheClient.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 ReactCacheClient.js?
ReactCacheClient.js defines 1 function(s): noopCacheSignal.
What does ReactCacheClient.js depend on?
ReactCacheClient.js imports 2 module(s): ReactCacheImpl.js, ReactFeatureFlags.
What files import ReactCacheClient.js?
ReactCacheClient.js is imported by 1 file(s): ReactClient.js.
Where is ReactCacheClient.js in the architecture?
ReactCacheClient.js is located at packages/react/src/ReactCacheClient.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react/src).

Analyze Your Own Codebase

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

Try Supermodel Free