Home / File/ todo-control-flow-sensitive-mutation.tsx — react Source File

todo-control-flow-sensitive-mutation.tsx — react Source File

Architecture documentation for todo-control-flow-sensitive-mutation.tsx, a tsx file in the react codebase. 2 imports, 0 dependents.

File tsx TestingUtilities Fixtures 2 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  3a9921a8_9f71_2f94_464d_e6b845574f2d["todo-control-flow-sensitive-mutation.tsx"]
  ac587885_e294_a1e9_b13f_5e7b920fdb42["react"]
  3a9921a8_9f71_2f94_464d_e6b845574f2d --> ac587885_e294_a1e9_b13f_5e7b920fdb42
  006eec3d_77a9_4a47_e6c1_a96d7a6c9c05["shared-runtime"]
  3a9921a8_9f71_2f94_464d_e6b845574f2d --> 006eec3d_77a9_4a47_e6c1_a96d7a6c9c05
  style 3a9921a8_9f71_2f94_464d_e6b845574f2d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

// @enablePreserveExistingMemoizationGuarantees:false @validateExhaustiveMemoizationDependencies:false
import {useMemo} from 'react';
import {
  mutate,
  typedCapture,
  typedCreateFrom,
  typedMutate,
  ValidateMemoization,
} from 'shared-runtime';

function Component({a, b, c}: {a: number; b: number; c: number}) {
  const x = useMemo(() => [{value: a}], [a, b, c]);
  if (b === 0) {
    // This object should only depend on c, it cannot be affected by the later mutation
    x.push({value: c});
  } else {
    // This mutation shouldn't affect the object in the consequent
    mutate(x);
  }

  return (
    <>
      <ValidateMemoization inputs={[a, b, c]} output={x} />;
      {/* TODO: should only depend on c */}
      <ValidateMemoization inputs={[a, b, c]} output={x[0]} />;
    </>
  );
}

export const FIXTURE_ENTRYPOINT = {
  fn: Component,
  params: [{a: 0, b: 0, c: 0}],
  sequentialRenders: [
    {a: 0, b: 0, c: 0},
    {a: 0, b: 1, c: 0},
    {a: 1, b: 1, c: 0},
    {a: 1, b: 1, c: 1},
    {a: 1, b: 1, c: 0},
    {a: 1, b: 0, c: 0},
    {a: 0, b: 0, c: 0},
  ],
};

Subdomains

Functions

Dependencies

  • react
  • shared-runtime

Frequently Asked Questions

What does todo-control-flow-sensitive-mutation.tsx do?
todo-control-flow-sensitive-mutation.tsx is a source file in the react codebase, written in tsx. It belongs to the TestingUtilities domain, Fixtures subdomain.
What functions are defined in todo-control-flow-sensitive-mutation.tsx?
todo-control-flow-sensitive-mutation.tsx defines 1 function(s): Component.
What does todo-control-flow-sensitive-mutation.tsx depend on?
todo-control-flow-sensitive-mutation.tsx imports 2 module(s): react, shared-runtime.
Where is todo-control-flow-sensitive-mutation.tsx in the architecture?
todo-control-flow-sensitive-mutation.tsx is located at compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/new-mutability/todo-control-flow-sensitive-mutation.tsx (domain: TestingUtilities, subdomain: Fixtures, directory: compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/new-mutability).

Analyze Your Own Codebase

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

Try Supermodel Free