Home / Function/ requestTransitionLane() — react Function Reference

requestTransitionLane() — react Function Reference

Architecture documentation for the requestTransitionLane() function in ReactFiberRootScheduler.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  1b2584b3_97ce_42e6_080f_e2dfd9f999a6["requestTransitionLane()"]
  a22f22c8_f97a_86c8_be5a_4b91a6a21eab["ReactFiberRootScheduler.js"]
  1b2584b3_97ce_42e6_080f_e2dfd9f999a6 -->|defined in| a22f22c8_f97a_86c8_be5a_4b91a6a21eab
  2e4f42a5_889a_dc6d_59d1_91763f97c720["cancelScheduledGesture()"]
  2e4f42a5_889a_dc6d_59d1_91763f97c720 -->|calls| 1b2584b3_97ce_42e6_080f_e2dfd9f999a6
  style 1b2584b3_97ce_42e6_080f_e2dfd9f999a6 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-reconciler/src/ReactFiberRootScheduler.js lines 697–723

export function requestTransitionLane(
  // This argument isn't used, it's only here to encourage the caller to
  // check that it's inside a transition before calling this function.
  // TODO: Make this non-nullable. Requires a tweak to useOptimistic.
  transition: Transition | null,
): Lane {
  // The algorithm for assigning an update to a lane should be stable for all
  // updates at the same priority within the same event. To do this, the
  // inputs to the algorithm must be the same.
  //
  // The trick we use is to cache the first of each of these inputs within an
  // event. Then reset the cached values once we can be sure the event is
  // over. Our heuristic for that is whenever we enter a concurrent work loop.
  if (currentEventTransitionLane === NoLane) {
    // All transitions within the same event are assigned the same lane.
    const actionScopeLane = peekEntangledActionLane();
    currentEventTransitionLane =
      actionScopeLane !== NoLane
        ? // We're inside an async action scope. Reuse the same lane.
          actionScopeLane
        : // We may or may not be inside an async action scope. If we are, this
          // is the first update in that scope. Either way, we need to get a
          // fresh transition lane.
          claimNextTransitionUpdateLane();
  }
  return currentEventTransitionLane;
}

Domain

Subdomains

Frequently Asked Questions

What does requestTransitionLane() do?
requestTransitionLane() is a function in the react codebase, defined in packages/react-reconciler/src/ReactFiberRootScheduler.js.
Where is requestTransitionLane() defined?
requestTransitionLane() is defined in packages/react-reconciler/src/ReactFiberRootScheduler.js at line 697.
What calls requestTransitionLane()?
requestTransitionLane() is called by 1 function(s): cancelScheduledGesture.

Analyze Your Own Codebase

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

Try Supermodel Free