Home / File/ repro-stale-closure-forward-reference.js — react Source File

repro-stale-closure-forward-reference.js — react Source File

Architecture documentation for repro-stale-closure-forward-reference.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
  21003c69_655c_07ca_a05a_7cc3c7634954["repro-stale-closure-forward-reference.js"]
  ac587885_e294_a1e9_b13f_5e7b920fdb42["react"]
  21003c69_655c_07ca_a05a_7cc3c7634954 --> ac587885_e294_a1e9_b13f_5e7b920fdb42
  style 21003c69_655c_07ca_a05a_7cc3c7634954 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import {useState} from 'react';

/**
 * Repro for https://github.com/facebook/react/issues/35122
 *
 * InferReactiveScopeVariables was excluding primitive operands
 * when considering operands for merging. We previously did not
 * infer types for context variables (StoreContext etc), but later
 * started inferring types in cases of `const` context variables,
 * since the type cannot change.
 *
 * In this example, this meant that we skipped the `isExpired`
 * operand of the onClick function expression when considering
 * scopes to merge.
 */
function Test1() {
  const [expire, setExpire] = useState(5);

  const onClick = () => {
    // Reference to isExpired prior to declaration
    console.log('isExpired', isExpired);
  };

  const isExpired = expire === 0;

  return <div onClick={onClick}>{expire}</div>;
}

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

Subdomains

Functions

Dependencies

  • react

Frequently Asked Questions

What does repro-stale-closure-forward-reference.js do?
repro-stale-closure-forward-reference.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 repro-stale-closure-forward-reference.js?
repro-stale-closure-forward-reference.js defines 1 function(s): Test1.
What does repro-stale-closure-forward-reference.js depend on?
repro-stale-closure-forward-reference.js imports 1 module(s): react.
Where is repro-stale-closure-forward-reference.js in the architecture?
repro-stale-closure-forward-reference.js is located at compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-stale-closure-forward-reference.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