Home / Function/ inferReactiveIdentifiers() — react Function Reference

inferReactiveIdentifiers() — react Function Reference

Architecture documentation for the inferReactiveIdentifiers() function in InferEffectDependencies.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  82ed3f4d_ad20_778d_000e_ca92ed3492fd["inferReactiveIdentifiers()"]
  3393f920_76eb_7dd5_b95f_ab92de6cecce["InferEffectDependencies.ts"]
  82ed3f4d_ad20_778d_000e_ca92ed3492fd -->|defined in| 3393f920_76eb_7dd5_b95f_ab92de6cecce
  3522f83b_2dff_3c9f_920f_3e428eb62b31["inferEffectDependencies()"]
  3522f83b_2dff_3c9f_920f_3e428eb62b31 -->|calls| 82ed3f4d_ad20_778d_000e_ca92ed3492fd
  ccace1c3_85b7_a05e_c2a5_7eff8b3422ed["eachInstructionOperand()"]
  82ed3f4d_ad20_778d_000e_ca92ed3492fd -->|calls| ccace1c3_85b7_a05e_c2a5_7eff8b3422ed
  41232a25_deb6_6e83_05a8_ae9f961656f7["eachTerminalOperand()"]
  82ed3f4d_ad20_778d_000e_ca92ed3492fd -->|calls| 41232a25_deb6_6e83_05a8_ae9f961656f7
  style 82ed3f4d_ad20_778d_000e_ca92ed3492fd fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/Inference/InferEffectDependencies.ts lines 492–515

function inferReactiveIdentifiers(fn: HIRFunction): Set<IdentifierId> {
  const reactiveIds: Set<IdentifierId> = new Set();
  for (const [, block] of fn.body.blocks) {
    for (const instr of block.instructions) {
      /**
       * No need to traverse into nested functions as
       * 1. their effects are recorded in `LoweredFunction.dependencies`
       * 2. we don't mark `reactive` in these anyways
       */
      for (const place of eachInstructionOperand(instr)) {
        if (place.reactive) {
          reactiveIds.add(place.identifier.id);
        }
      }
    }

    for (const place of eachTerminalOperand(block.terminal)) {
      if (place.reactive) {
        reactiveIds.add(place.identifier.id);
      }
    }
  }
  return reactiveIds;
}

Domain

Subdomains

Frequently Asked Questions

What does inferReactiveIdentifiers() do?
inferReactiveIdentifiers() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/Inference/InferEffectDependencies.ts.
Where is inferReactiveIdentifiers() defined?
inferReactiveIdentifiers() is defined in compiler/packages/babel-plugin-react-compiler/src/Inference/InferEffectDependencies.ts at line 492.
What does inferReactiveIdentifiers() call?
inferReactiveIdentifiers() calls 2 function(s): eachInstructionOperand, eachTerminalOperand.
What calls inferReactiveIdentifiers()?
inferReactiveIdentifiers() is called by 1 function(s): inferEffectDependencies.

Analyze Your Own Codebase

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

Try Supermodel Free