Home / File/ log-pruned-memoization.js — react Source File

log-pruned-memoization.js — react Source File

Architecture documentation for log-pruned-memoization.js, a javascript file in the react codebase. 2 imports, 0 dependents.

File javascript TestingUtilities Fixtures 2 imports 2 functions

Entity Profile

Dependency Diagram

graph LR
  9b5b1e30_30c7_2b2a_848f_fd987d36fdc8["log-pruned-memoization.js"]
  ac587885_e294_a1e9_b13f_5e7b920fdb42["react"]
  9b5b1e30_30c7_2b2a_848f_fd987d36fdc8 --> ac587885_e294_a1e9_b13f_5e7b920fdb42
  006eec3d_77a9_4a47_e6c1_a96d7a6c9c05["shared-runtime"]
  9b5b1e30_30c7_2b2a_848f_fd987d36fdc8 --> 006eec3d_77a9_4a47_e6c1_a96d7a6c9c05
  style 9b5b1e30_30c7_2b2a_848f_fd987d36fdc8 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

// @loggerTestOnly
import {createContext, use, useState} from 'react';
import {
  Stringify,
  identity,
  makeObject_Primitives,
  useHook,
} from 'shared-runtime';

function Component() {
  const w = use(Context);

  // The scopes for x and x2 are interleaved, so this is one scope with two values
  const x = makeObject_Primitives();
  const x2 = makeObject_Primitives();
  useState(null);
  identity(x);
  identity(x2);

  // We create a scope for all call expressions, but prune those with hook calls
  // in this case it's _just_ a hook call, so we don't count this as pruned
  const y = useHook();

  const z = [];
  for (let i = 0; i < 10; i++) {
    // The scope for obj is pruned bc it's in a loop
    const obj = makeObject_Primitives();
    z.push(obj);
  }

  // Overall we expect two pruned scopes (for x+x2, and obj), with 3 pruned scope values.
  return <Stringify items={[w, x, x2, y, z]} />;
}

const Context = createContext();

function Wrapper() {
  return (
    <Context value={42}>
      <Component />
    </Context>
  );
}

export const FIXTURE_ENTRYPOINT = {
  fn: Wrapper,
  params: [{}],
};

Subdomains

Dependencies

  • react
  • shared-runtime

Frequently Asked Questions

What does log-pruned-memoization.js do?
log-pruned-memoization.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 log-pruned-memoization.js?
log-pruned-memoization.js defines 2 function(s): Component, Wrapper.
What does log-pruned-memoization.js depend on?
log-pruned-memoization.js imports 2 module(s): react, shared-runtime.
Where is log-pruned-memoization.js in the architecture?
log-pruned-memoization.js is located at compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/log-pruned-memoization.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