Home / Function/ addDerivationEntry() — react Function Reference

addDerivationEntry() — react Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  d47181e1_cf8f_56cd_bdd7_4bce6f7d15d9["addDerivationEntry()"]
  d898e8d4_bae5_bd1e_6da8_d32cb643c20a["DerivationCache"]
  d47181e1_cf8f_56cd_bdd7_4bce6f7d15d9 -->|defined in| d898e8d4_bae5_bd1e_6da8_d32cb643c20a
  2d80e3d3_eaf3_911b_9f07_e94ea4f8013f["recordPhiDerivations()"]
  2d80e3d3_eaf3_911b_9f07_e94ea4f8013f -->|calls| d47181e1_cf8f_56cd_bdd7_4bce6f7d15d9
  23e95905_7740_9185_1ad6_1a529d6f88ad["recordInstructionDerivations()"]
  23e95905_7740_9185_1ad6_1a529d6f88ad -->|calls| d47181e1_cf8f_56cd_bdd7_4bce6f7d15d9
  style d47181e1_cf8f_56cd_bdd7_4bce6f7d15d9 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateNoDerivedComputationsInEffects_exp.ts lines 105–131

  addDerivationEntry(
    derivedVar: Place,
    sourcesIds: Set<IdentifierId>,
    typeOfValue: TypeOfValue,
    isStateSource: boolean,
  ): void {
    let finalIsSource = isStateSource;
    if (!finalIsSource) {
      for (const sourceId of sourcesIds) {
        const sourceMetadata = this.cache.get(sourceId);
        if (
          sourceMetadata?.isStateSource &&
          sourceMetadata.place.identifier.name?.kind !== 'named'
        ) {
          finalIsSource = true;
          break;
        }
      }
    }

    this.cache.set(derivedVar.identifier.id, {
      place: derivedVar,
      sourcesIds: sourcesIds,
      typeOfValue: typeOfValue ?? 'ignored',
      isStateSource: finalIsSource,
    });
  }

Domain

Subdomains

Frequently Asked Questions

What does addDerivationEntry() do?
addDerivationEntry() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateNoDerivedComputationsInEffects_exp.ts.
Where is addDerivationEntry() defined?
addDerivationEntry() is defined in compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateNoDerivedComputationsInEffects_exp.ts at line 105.
What calls addDerivationEntry()?
addDerivationEntry() is called by 2 function(s): recordInstructionDerivations, recordPhiDerivations.

Analyze Your Own Codebase

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

Try Supermodel Free