Home / Function/ scheduleLoop() — react Function Reference

scheduleLoop() — react Function Reference

Architecture documentation for the scheduleLoop() function in BuildReactiveFunction.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  98473280_e771_cfd6_8eda_8978bff6b1fc["scheduleLoop()"]
  4f68940d_e29b_1b55_8b23_bd29e8900efa["Context"]
  98473280_e771_cfd6_8eda_8978bff6b1fc -->|defined in| 4f68940d_e29b_1b55_8b23_bd29e8900efa
  59c4bc0e_ec5f_af0c_d67c_d518b3f117bc["visitBlock()"]
  59c4bc0e_ec5f_af0c_d67c_d518b3f117bc -->|calls| 98473280_e771_cfd6_8eda_8978bff6b1fc
  041ca752_10c1_3cda_1f5c_02f44a01310e["invariant()"]
  98473280_e771_cfd6_8eda_8978bff6b1fc -->|calls| 041ca752_10c1_3cda_1f5c_02f44a01310e
  073c81a5_c389_d108_5b8f_4d6dc6eece83["push()"]
  98473280_e771_cfd6_8eda_8978bff6b1fc -->|calls| 073c81a5_c389_d108_5b8f_4d6dc6eece83
  style 98473280_e771_cfd6_8eda_8978bff6b1fc fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/BuildReactiveFunction.ts lines 1310–1339

  scheduleLoop(
    fallthroughBlock: BlockId,
    continueBlock: BlockId,
    loopBlock: BlockId | null,
  ): number {
    const id = this.#nextScheduleId++;
    const ownsBlock = !this.#scheduled.has(fallthroughBlock);
    this.#scheduled.add(fallthroughBlock);
    CompilerError.invariant(!this.#scheduled.has(continueBlock), {
      reason: `Continue block is already scheduled: bb${continueBlock}`,
      loc: GeneratedSource,
    });
    this.#scheduled.add(continueBlock);
    let ownsLoop = false;
    if (loopBlock !== null) {
      ownsLoop = !this.#scheduled.has(loopBlock);
      this.#scheduled.add(loopBlock);
    }

    this.#controlFlowStack.push({
      block: fallthroughBlock,
      ownsBlock,
      id,
      type: 'loop',
      continueBlock,
      loopBlock,
      ownsLoop,
    });
    return id;
  }

Domain

Subdomains

Called By

Frequently Asked Questions

What does scheduleLoop() do?
scheduleLoop() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/BuildReactiveFunction.ts.
Where is scheduleLoop() defined?
scheduleLoop() is defined in compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/BuildReactiveFunction.ts at line 1310.
What does scheduleLoop() call?
scheduleLoop() calls 2 function(s): invariant, push.
What calls scheduleLoop()?
scheduleLoop() is called by 1 function(s): visitBlock.

Analyze Your Own Codebase

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

Try Supermodel Free