Home / Function/ validateNoRefUpdate() — react Function Reference

validateNoRefUpdate() — react Function Reference

Architecture documentation for the validateNoRefUpdate() function in ValidateNoRefAccessInRender.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  4be2e487_2f0a_9c9e_a130_f8236e6101bf["validateNoRefUpdate()"]
  8dbbe52d_b145_88fe_e0da_33d06180b558["ValidateNoRefAccessInRender.ts"]
  4be2e487_2f0a_9c9e_a130_f8236e6101bf -->|defined in| 8dbbe52d_b145_88fe_e0da_33d06180b558
  b2292640_a950_f66a_1a21_4fa1d74f094d["validateNoRefAccessInRenderImpl()"]
  b2292640_a950_f66a_1a21_4fa1d74f094d -->|calls| 4be2e487_2f0a_9c9e_a130_f8236e6101bf
  5ff0aef2_aec1_821c_3407_8b71cc244fe1["destructure()"]
  4be2e487_2f0a_9c9e_a130_f8236e6101bf -->|calls| 5ff0aef2_aec1_821c_3407_8b71cc244fe1
  03dffe4e_b34b_74b6_636a_f8dfe1a2b604["get()"]
  4be2e487_2f0a_9c9e_a130_f8236e6101bf -->|calls| 03dffe4e_b34b_74b6_636a_f8dfe1a2b604
  02303def_636f_c5b3_a751_1cf138fcea69["pushDiagnostic()"]
  4be2e487_2f0a_9c9e_a130_f8236e6101bf -->|calls| 02303def_636f_c5b3_a751_1cf138fcea69
  ac13f5c1_be17_dd7a_6bd3_66d91c46aadf["create()"]
  4be2e487_2f0a_9c9e_a130_f8236e6101bf -->|calls| ac13f5c1_be17_dd7a_6bd3_66d91c46aadf
  1a2b7047_24c8_62d6_b328_5f07307d27ab["withDetails()"]
  4be2e487_2f0a_9c9e_a130_f8236e6101bf -->|calls| 1a2b7047_24c8_62d6_b328_5f07307d27ab
  style 4be2e487_2f0a_9c9e_a130_f8236e6101bf fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateNoRefAccessInRender.ts lines 835–855

function validateNoRefUpdate(
  errors: CompilerError,
  env: Env,
  operand: Place,
  loc: SourceLocation,
): void {
  const type = destructure(env.get(operand.identifier.id));
  if (type?.kind === 'Ref' || type?.kind === 'RefValue') {
    errors.pushDiagnostic(
      CompilerDiagnostic.create({
        category: ErrorCategory.Refs,
        reason: 'Cannot access refs during render',
        description: ERROR_DESCRIPTION,
      }).withDetails({
        kind: 'error',
        loc: (type.kind === 'RefValue' && type.loc) || loc,
        message: `Cannot update ref during render`,
      }),
    );
  }
}

Domain

Subdomains

Frequently Asked Questions

What does validateNoRefUpdate() do?
validateNoRefUpdate() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateNoRefAccessInRender.ts.
Where is validateNoRefUpdate() defined?
validateNoRefUpdate() is defined in compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateNoRefAccessInRender.ts at line 835.
What does validateNoRefUpdate() call?
validateNoRefUpdate() calls 5 function(s): create, destructure, get, pushDiagnostic, withDetails.
What calls validateNoRefUpdate()?
validateNoRefUpdate() is called by 1 function(s): validateNoRefAccessInRenderImpl.

Analyze Your Own Codebase

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

Try Supermodel Free