Home / File/ mutation-within-capture-and-mutablerange.tsx — react Source File

mutation-within-capture-and-mutablerange.tsx — react Source File

Architecture documentation for mutation-within-capture-and-mutablerange.tsx, a tsx file in the react codebase. 1 imports, 0 dependents.

File tsx TestingUtilities Fixtures 1 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  eef1555e_3e70_2fb6_ccdc_fe5d3706f4db["mutation-within-capture-and-mutablerange.tsx"]
  006eec3d_77a9_4a47_e6c1_a96d7a6c9c05["shared-runtime"]
  eef1555e_3e70_2fb6_ccdc_fe5d3706f4db --> 006eec3d_77a9_4a47_e6c1_a96d7a6c9c05
  style eef1555e_3e70_2fb6_ccdc_fe5d3706f4db fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import {mutate} from 'shared-runtime';

/**
 * This test fixture is similar to mutation-within-jsx. The only difference
 * is that there is no `freeze` effect here, which means that `z` may be
 * mutated after its memo block through mutating `y`.
 *
 * While this is technically correct (as `z` is a nested memo block), it
 * is an edge case as we believe that values are not mutated after their
 * memo blocks (which may lead to 'tearing', i.e. mutating one render's
 * values in a subsequent render.
 */
function useFoo({a, b}) {
  // x and y's scopes start here
  const x = {a};
  const y = [b];
  mutate(x);
  // z captures the result of `mutate(y)`, which may be aliased to `y`.
  const z = [mutate(y)];
  // the following line may also mutate z
  mutate(y);
  // and end here
  return z;
}

export const FIXTURE_ENTRYPOINT = {
  fn: useFoo,
  params: [{a: 2, b: 3}],
};

Subdomains

Functions

Dependencies

  • shared-runtime

Frequently Asked Questions

What does mutation-within-capture-and-mutablerange.tsx do?
mutation-within-capture-and-mutablerange.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 mutation-within-capture-and-mutablerange.tsx?
mutation-within-capture-and-mutablerange.tsx defines 1 function(s): useFoo.
What does mutation-within-capture-and-mutablerange.tsx depend on?
mutation-within-capture-and-mutablerange.tsx imports 1 module(s): shared-runtime.
Where is mutation-within-capture-and-mutablerange.tsx in the architecture?
mutation-within-capture-and-mutablerange.tsx is located at compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/mutation-within-capture-and-mutablerange.tsx (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