Home / Function/ buildSets() — react Function Reference

buildSets() — react Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  631ac101_c6b9_8c55_7557_0bce62532665["buildSets()"]
  1765a682_3028_4441_b26f_c712ca2597d5["DisjointSet"]
  631ac101_c6b9_8c55_7557_0bce62532665 -->|defined in| 1765a682_3028_4441_b26f_c712ca2597d5
  382ec0a6_259a_0930_660b_107b02378e40["printAliases()"]
  382ec0a6_259a_0930_660b_107b02378e40 -->|calls| 631ac101_c6b9_8c55_7557_0bce62532665
  4c434fb2_75ab_6c2c_c237_b1d38a1b0141["forEach()"]
  631ac101_c6b9_8c55_7557_0bce62532665 -->|calls| 4c434fb2_75ab_6c2c_c237_b1d38a1b0141
  style 631ac101_c6b9_8c55_7557_0bce62532665 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/Utils/DisjointSet.ts lines 108–128

  buildSets(): Array<Set<T>> {
    const ids: Map<T, number> = new Map();
    const sets: Map<number, Set<T>> = new Map();

    this.forEach((identifier, groupIdentifier) => {
      let id = ids.get(groupIdentifier);
      if (id == null) {
        id = ids.size;
        ids.set(groupIdentifier, id);
      }

      let set = sets.get(id);
      if (set === undefined) {
        set = new Set();
        sets.set(id, set);
      }
      set.add(identifier);
    });

    return [...sets.values()];
  }

Domain

Subdomains

Calls

Called By

Frequently Asked Questions

What does buildSets() do?
buildSets() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/Utils/DisjointSet.ts.
Where is buildSets() defined?
buildSets() is defined in compiler/packages/babel-plugin-react-compiler/src/Utils/DisjointSet.ts at line 108.
What does buildSets() call?
buildSets() calls 1 function(s): forEach.
What calls buildSets()?
buildSets() is called by 1 function(s): printAliases.

Analyze Your Own Codebase

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

Try Supermodel Free