Home / Function/ transformScope() — react Function Reference

transformScope() — react Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  b2563d99_6456_0163_2dd9_9a9290ad87a8["transformScope()"]
  ae117d0c_24d0_3002_1a6e_1e952a421d6e["Transform"]
  b2563d99_6456_0163_2dd9_9a9290ad87a8 -->|defined in| ae117d0c_24d0_3002_1a6e_1e952a421d6e
  4acb57df_5348_9aab_9691_41cf35127db4["visitScope()"]
  b2563d99_6456_0163_2dd9_9a9290ad87a8 -->|calls| 4acb57df_5348_9aab_9691_41cf35127db4
  b639747b_32c3_a4bf_867f_dba5d3901073["transformScope()"]
  b2563d99_6456_0163_2dd9_9a9290ad87a8 -->|calls| b639747b_32c3_a4bf_867f_dba5d3901073
  7bed2ca3_d37d_8807_1d7c_c0ae2d6dbc64["areEqualDependencies()"]
  b2563d99_6456_0163_2dd9_9a9290ad87a8 -->|calls| 7bed2ca3_d37d_8807_1d7c_c0ae2d6dbc64
  style b2563d99_6456_0163_2dd9_9a9290ad87a8 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/MergeReactiveScopesThatInvalidateTogether.ts lines 130–143

  override transformScope(
    scopeBlock: ReactiveScopeBlock,
    state: ReactiveScopeDependencies | null,
  ): Transformed<ReactiveStatement> {
    this.visitScope(scopeBlock, scopeBlock.scope.dependencies);
    if (
      state !== null &&
      areEqualDependencies(state, scopeBlock.scope.dependencies)
    ) {
      return {kind: 'replace-many', value: scopeBlock.instructions};
    } else {
      return {kind: 'keep'};
    }
  }

Domain

Subdomains

Frequently Asked Questions

What does transformScope() do?
transformScope() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/MergeReactiveScopesThatInvalidateTogether.ts.
Where is transformScope() defined?
transformScope() is defined in compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/MergeReactiveScopesThatInvalidateTogether.ts at line 130.
What does transformScope() call?
transformScope() calls 3 function(s): areEqualDependencies, transformScope, visitScope.

Analyze Your Own Codebase

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

Try Supermodel Free