Home / Function/ scopeIsEligibleForMerging() — react Function Reference

scopeIsEligibleForMerging() — react Function Reference

Architecture documentation for the scopeIsEligibleForMerging() function in MergeReactiveScopesThatInvalidateTogether.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  432e8f07_8888_739b_b310_8ed9622fdd73["scopeIsEligibleForMerging()"]
  006711fe_6949_9be8_4726_2031284f3328["MergeReactiveScopesThatInvalidateTogether.ts"]
  432e8f07_8888_739b_b310_8ed9622fdd73 -->|defined in| 006711fe_6949_9be8_4726_2031284f3328
  11690004_c468_3b6b_f07f_36a6501f870a["visitBlock()"]
  11690004_c468_3b6b_f07f_36a6501f870a -->|calls| 432e8f07_8888_739b_b310_8ed9622fdd73
  aed61a37_60c8_9eae_ac35_b13a46157096["isAlwaysInvalidatingType()"]
  432e8f07_8888_739b_b310_8ed9622fdd73 -->|calls| aed61a37_60c8_9eae_ac35_b13a46157096
  style 432e8f07_8888_739b_b310_8ed9622fdd73 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/MergeReactiveScopesThatInvalidateTogether.ts lines 559–570

function scopeIsEligibleForMerging(scopeBlock: ReactiveScopeBlock): boolean {
  if (scopeBlock.scope.dependencies.size === 0) {
    /*
     * Regardless of the type of value produced, if the scope has no dependencies
     * then its value will never change.
     */
    return true;
  }
  return [...scopeBlock.scope.declarations].some(([, decl]) =>
    isAlwaysInvalidatingType(decl.identifier.type),
  );
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does scopeIsEligibleForMerging() do?
scopeIsEligibleForMerging() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/MergeReactiveScopesThatInvalidateTogether.ts.
Where is scopeIsEligibleForMerging() defined?
scopeIsEligibleForMerging() is defined in compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/MergeReactiveScopesThatInvalidateTogether.ts at line 559.
What does scopeIsEligibleForMerging() call?
scopeIsEligibleForMerging() calls 1 function(s): isAlwaysInvalidatingType.
What calls scopeIsEligibleForMerging()?
scopeIsEligibleForMerging() is called by 1 function(s): visitBlock.

Analyze Your Own Codebase

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

Try Supermodel Free