Home / File/ useMemo-mabye-modified-free-variable-preserve-memoization-guarantees.js — react Source File

useMemo-mabye-modified-free-variable-preserve-memoization-guarantees.js — react Source File

Architecture documentation for useMemo-mabye-modified-free-variable-preserve-memoization-guarantees.js, a javascript file in the react codebase. 2 imports, 0 dependents.

File javascript TestingUtilities Fixtures 2 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  aceb0000_0c66_d7a3_8035_c5c0c0f65435["useMemo-mabye-modified-free-variable-preserve-memoization-guarantees.js"]
  ac587885_e294_a1e9_b13f_5e7b920fdb42["react"]
  aceb0000_0c66_d7a3_8035_c5c0c0f65435 --> ac587885_e294_a1e9_b13f_5e7b920fdb42
  006eec3d_77a9_4a47_e6c1_a96d7a6c9c05["shared-runtime"]
  aceb0000_0c66_d7a3_8035_c5c0c0f65435 --> 006eec3d_77a9_4a47_e6c1_a96d7a6c9c05
  style aceb0000_0c66_d7a3_8035_c5c0c0f65435 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

// @enablePreserveExistingMemoizationGuarantees
import {useMemo} from 'react';
import {identity, makeObject_Primitives, mutate, useHook} from 'shared-runtime';

function Component(props) {
  // With the feature enabled these variables are inferred as frozen as of
  // the useMemo call
  const free = makeObject_Primitives();
  const free2 = makeObject_Primitives();
  const part = free2.part;

  // Thus their mutable range ends prior to this hook call, and both the above
  // values and the useMemo block value can be memoized
  useHook();

  const object = useMemo(() => {
    const x = makeObject_Primitives();
    x.value = props.value;
    mutate(x, free, part);
    return x;
  }, [props.value, free, part]);

  // These calls should be inferred as non-mutating due to the above freeze inference
  identity(free);
  identity(part);

  return object;
}

export const FIXTURE_ENTRYPOINT = {
  fn: Component,
  params: [{value: 42}],
};

Subdomains

Functions

Dependencies

  • react
  • shared-runtime

Frequently Asked Questions

What does useMemo-mabye-modified-free-variable-preserve-memoization-guarantees.js do?
useMemo-mabye-modified-free-variable-preserve-memoization-guarantees.js is a source file in the react codebase, written in javascript. It belongs to the TestingUtilities domain, Fixtures subdomain.
What functions are defined in useMemo-mabye-modified-free-variable-preserve-memoization-guarantees.js?
useMemo-mabye-modified-free-variable-preserve-memoization-guarantees.js defines 1 function(s): Component.
What does useMemo-mabye-modified-free-variable-preserve-memoization-guarantees.js depend on?
useMemo-mabye-modified-free-variable-preserve-memoization-guarantees.js imports 2 module(s): react, shared-runtime.
Where is useMemo-mabye-modified-free-variable-preserve-memoization-guarantees.js in the architecture?
useMemo-mabye-modified-free-variable-preserve-memoization-guarantees.js is located at compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/useMemo-mabye-modified-free-variable-preserve-memoization-guarantees.js (domain: TestingUtilities, subdomain: Fixtures, directory: compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler).

Analyze Your Own Codebase

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

Try Supermodel Free