Home / Function/ mergeExtraSegments() — react Function Reference

mergeExtraSegments() — react Function Reference

Architecture documentation for the mergeExtraSegments() function in fork-context.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  0b00665b_8c93_1b24_7c1d_e6a9d77e0392["mergeExtraSegments()"]
  07cca28a_69a9_0c86_6a6b_dd21af903a1e["fork-context.js"]
  0b00665b_8c93_1b24_7c1d_e6a9d77e0392 -->|defined in| 07cca28a_69a9_0c86_6a6b_dd21af903a1e
  45f8c3bb_4c36_718d_e04b_0bbd066a1177["add()"]
  45f8c3bb_4c36_718d_e04b_0bbd066a1177 -->|calls| 0b00665b_8c93_1b24_7c1d_e6a9d77e0392
  4cd7af73_2fb2_63dc_0b10_8600b5493d3c["replaceHead()"]
  4cd7af73_2fb2_63dc_0b10_8600b5493d3c -->|calls| 0b00665b_8c93_1b24_7c1d_e6a9d77e0392
  style 0b00665b_8c93_1b24_7c1d_e6a9d77e0392 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/eslint-plugin-react-hooks/src/code-path-analysis/fork-context.js lines 67–88

function mergeExtraSegments(context, segments) {
  let currentSegments = segments;

  while (currentSegments.length > context.count) {
    const merged = [];

    for (
      let i = 0, length = (currentSegments.length / 2) | 0;
      i < length;
      ++i
    ) {
      merged.push(
        CodePathSegment.newNext(context.idGenerator.next(), [
          currentSegments[i],
          currentSegments[i + length],
        ]),
      );
    }
    currentSegments = merged;
  }
  return currentSegments;
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does mergeExtraSegments() do?
mergeExtraSegments() is a function in the react codebase, defined in packages/eslint-plugin-react-hooks/src/code-path-analysis/fork-context.js.
Where is mergeExtraSegments() defined?
mergeExtraSegments() is defined in packages/eslint-plugin-react-hooks/src/code-path-analysis/fork-context.js at line 67.
What calls mergeExtraSegments()?
mergeExtraSegments() is called by 2 function(s): add, replaceHead.

Analyze Your Own Codebase

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

Try Supermodel Free