Home / Function/ find() — react Function Reference

find() — react Function Reference

Architecture documentation for the find() function in DisjointSet.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  74efde51_a311_d84c_0e23_ddafd072e338["find()"]
  1765a682_3028_4441_b26f_c712ca2597d5["DisjointSet"]
  74efde51_a311_d84c_0e23_ddafd072e338 -->|defined in| 1765a682_3028_4441_b26f_c712ca2597d5
  ee1add24_e8b1_776d_87ba_d88fe78f7873["mergeOverlappingReactiveScopesHIR()"]
  ee1add24_e8b1_776d_87ba_d88fe78f7873 -->|calls| 74efde51_a311_d84c_0e23_ddafd072e338
  35406eee_9521_0419_7a1e_5d1f16da6f89["isReactive()"]
  35406eee_9521_0419_7a1e_5d1f16da6f89 -->|calls| 74efde51_a311_d84c_0e23_ddafd072e338
  a9512b67_abe2_2599_90d7_8e0d1c81a618["markReactive()"]
  a9512b67_abe2_2599_90d7_8e0d1c81a618 -->|calls| 74efde51_a311_d84c_0e23_ddafd072e338
  bdad7522_9507_6e0a_8551_e304482ab97e["alignMethodCallScopes()"]
  bdad7522_9507_6e0a_8551_e304482ab97e -->|calls| 74efde51_a311_d84c_0e23_ddafd072e338
  eb5a8bba_982f_3e93_34ad_57191041e6d7["visitScope()"]
  eb5a8bba_982f_3e93_34ad_57191041e6d7 -->|calls| 74efde51_a311_d84c_0e23_ddafd072e338
  07c13165_58f3_ceca_b2dc_dd9078d09c17["getAliases()"]
  07c13165_58f3_ceca_b2dc_dd9078d09c17 -->|calls| 74efde51_a311_d84c_0e23_ddafd072e338
  a89a21a8_52fd_f4df_8805_31b9e3fb228e["union()"]
  a89a21a8_52fd_f4df_8805_31b9e3fb228e -->|calls| 74efde51_a311_d84c_0e23_ddafd072e338
  cc6dbdb8_321f_04a6_e222_5616c33d7c7c["canonicalize()"]
  cc6dbdb8_321f_04a6_e222_5616c33d7c7c -->|calls| 74efde51_a311_d84c_0e23_ddafd072e338
  4c434fb2_75ab_6c2c_c237_b1d38a1b0141["forEach()"]
  4c434fb2_75ab_6c2c_c237_b1d38a1b0141 -->|calls| 74efde51_a311_d84c_0e23_ddafd072e338
  d17d77ab_7e43_9266_e176_75b6266f6340["has()"]
  74efde51_a311_d84c_0e23_ddafd072e338 -->|calls| d17d77ab_7e43_9266_e176_75b6266f6340
  style 74efde51_a311_d84c_0e23_ddafd072e338 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/Utils/DisjointSet.ts lines 64–78

  find(item: T): T | null {
    if (!this.#entries.has(item)) {
      return null;
    }
    const parent = this.#entries.get(item)!;
    if (parent === item) {
      // this is the root element
      return item;
    }
    // Recurse to find the root (caching all elements along the path to the root)
    const root = this.find(parent)!;
    // Cache the element itself
    this.#entries.set(item, root);
    return root;
  }

Domain

Subdomains

Calls

Frequently Asked Questions

What does find() do?
find() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/Utils/DisjointSet.ts.
Where is find() defined?
find() is defined in compiler/packages/babel-plugin-react-compiler/src/Utils/DisjointSet.ts at line 64.
What does find() call?
find() calls 1 function(s): has.
What calls find()?
find() is called by 9 function(s): alignMethodCallScopes, canonicalize, forEach, getAliases, isReactive, markReactive, mergeOverlappingReactiveScopesHIR, union, and 1 more.

Analyze Your Own Codebase

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

Try Supermodel Free