Home / File/ context-var-granular-dep.js — react Source File

context-var-granular-dep.js — react Source File

Architecture documentation for context-var-granular-dep.js, a javascript file in the react codebase. 1 imports, 0 dependents.

File javascript TestingUtilities Fixtures 1 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  d8176708_fc7f_f677_5d6e_baca69fa9191["context-var-granular-dep.js"]
  006eec3d_77a9_4a47_e6c1_a96d7a6c9c05["shared-runtime"]
  d8176708_fc7f_f677_5d6e_baca69fa9191 --> 006eec3d_77a9_4a47_e6c1_a96d7a6c9c05
  style d8176708_fc7f_f677_5d6e_baca69fa9191 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import {throwErrorWithMessage, ValidateMemoization} from 'shared-runtime';

/**
 * Context variables are local variables that (1) have at least one reassignment
 * and (2) are captured into a function expression. These have a known mutable
 * range: from first declaration / assignment to the last direct or aliased,
 * mutable reference.
 *
 * This fixture validates that forget can take granular dependencies on context
 * variables when the reference to a context var happens *after* the end of its
 * mutable range.
 */
function Component({cond, a}) {
  let contextVar;
  if (cond) {
    contextVar = {val: a};
  } else {
    contextVar = {};
    throwErrorWithMessage('');
  }
  const cb = {cb: () => contextVar.val * 4};

  /**
   * manually specify input to avoid adding a `PropertyLoad` from contextVar,
   * which might affect hoistable-objects analysis.
   */
  return (
    <ValidateMemoization
      inputs={[cond ? a : undefined]}
      output={cb}
      onlyCheckCompiled={true}
    />
  );
}

export const FIXTURE_ENTRYPOINT = {
  fn: Component,
  params: [{cond: false, a: undefined}],
  sequentialRenders: [
    {cond: true, a: 2},
    {cond: true, a: 2},
  ],
};

Subdomains

Functions

Dependencies

  • shared-runtime

Frequently Asked Questions

What does context-var-granular-dep.js do?
context-var-granular-dep.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 context-var-granular-dep.js?
context-var-granular-dep.js defines 1 function(s): Component.
What does context-var-granular-dep.js depend on?
context-var-granular-dep.js imports 1 module(s): shared-runtime.
Where is context-var-granular-dep.js in the architecture?
context-var-granular-dep.js is located at compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/context-var-granular-dep.js (domain: TestingUtilities, subdomain: Fixtures, directory: compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps).

Analyze Your Own Codebase

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

Try Supermodel Free