Home / Function/ checkForChanges() — react Function Reference

checkForChanges() — react Function Reference

Architecture documentation for the checkForChanges() function in ValidateNoDerivedComputationsInEffects_exp.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  c50dbb50_939e_8d12_f49a_d3815a85e074["checkForChanges()"]
  d898e8d4_bae5_bd1e_6da8_d32cb643c20a["DerivationCache"]
  c50dbb50_939e_8d12_f49a_d3815a85e074 -->|defined in| d898e8d4_bae5_bd1e_6da8_d32cb643c20a
  f9f36408_8e51_961b_c26d_24ee285bd479["validateNoDerivedComputationsInEffects_exp()"]
  f9f36408_8e51_961b_c26d_24ee285bd479 -->|calls| c50dbb50_939e_8d12_f49a_d3815a85e074
  2141364e_ec22_da13_4057_580069c4b486["isDerivationEqual()"]
  c50dbb50_939e_8d12_f49a_d3815a85e074 -->|calls| 2141364e_ec22_da13_4057_580069c4b486
  style c50dbb50_939e_8d12_f49a_d3815a85e074 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateNoDerivedComputationsInEffects_exp.ts lines 74–97

  checkForChanges(): void {
    if (this.previousCache === null) {
      this.hasChanges = true;
      return;
    }

    for (const [key, value] of this.cache.entries()) {
      const previousValue = this.previousCache.get(key);
      if (
        previousValue === undefined ||
        !this.isDerivationEqual(previousValue, value)
      ) {
        this.hasChanges = true;
        return;
      }
    }

    if (this.cache.size !== this.previousCache.size) {
      this.hasChanges = true;
      return;
    }

    this.hasChanges = false;
  }

Domain

Subdomains

Frequently Asked Questions

What does checkForChanges() do?
checkForChanges() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateNoDerivedComputationsInEffects_exp.ts.
Where is checkForChanges() defined?
checkForChanges() is defined in compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateNoDerivedComputationsInEffects_exp.ts at line 74.
What does checkForChanges() call?
checkForChanges() calls 1 function(s): isDerivationEqual.
What calls checkForChanges()?
checkForChanges() is called by 1 function(s): validateNoDerivedComputationsInEffects_exp.

Analyze Your Own Codebase

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

Try Supermodel Free