Home / File/ array-concat-should-capture.ts — react Source File

array-concat-should-capture.ts — react Source File

Architecture documentation for array-concat-should-capture.ts, a typescript file in the react codebase. 1 imports, 0 dependents.

File typescript TestingUtilities Fixtures 1 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  8dd8b70a_6489_a2af_ec44_fc65a83a357b["array-concat-should-capture.ts"]
  006eec3d_77a9_4a47_e6c1_a96d7a6c9c05["shared-runtime"]
  8dd8b70a_6489_a2af_ec44_fc65a83a357b --> 006eec3d_77a9_4a47_e6c1_a96d7a6c9c05
  style 8dd8b70a_6489_a2af_ec44_fc65a83a357b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import {mutate} from 'shared-runtime';

/**
 * Fixture showing why `concat` needs to capture both the callee and rest args.
 * Here, observe that arr1's values are captured into arr2.
 *  - Later mutations of arr2 may write to values within arr1.
 *  - Observe that it's technically valid to separately memoize the array arr1
 *    itself.
 */
function Foo({inputNum}) {
  const arr1: Array<number | object> = [{a: 1}, {}];
  const arr2 = arr1.concat([1, inputNum]);
  mutate(arr2[0]);
  return arr2;
}

export const FIXTURE_ENTRYPOINT = {
  fn: Foo,
  params: [{inputNum: 2}],
  sequentialRenders: [{inputNum: 2}, {inputNum: 3}],
};

Subdomains

Functions

Dependencies

  • shared-runtime

Frequently Asked Questions

What does array-concat-should-capture.ts do?
array-concat-should-capture.ts is a source file in the react codebase, written in typescript. It belongs to the TestingUtilities domain, Fixtures subdomain.
What functions are defined in array-concat-should-capture.ts?
array-concat-should-capture.ts defines 1 function(s): Foo.
What does array-concat-should-capture.ts depend on?
array-concat-should-capture.ts imports 1 module(s): shared-runtime.
Where is array-concat-should-capture.ts in the architecture?
array-concat-should-capture.ts is located at compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/array-concat-should-capture.ts (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