Home / Function/ startHostActionTimer() — react Function Reference

startHostActionTimer() — react Function Reference

Architecture documentation for the startHostActionTimer() function in ReactProfilerTimer.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  2cf1fdb3_db49_dc37_8215_030ce6e42da3["startHostActionTimer()"]
  e054b9c7_41f1_c7f7_97bb_98b6a445e94b["ReactProfilerTimer.js"]
  2cf1fdb3_db49_dc37_8215_030ce6e42da3 -->|defined in| e054b9c7_41f1_c7f7_97bb_98b6a445e94b
  style 2cf1fdb3_db49_dc37_8215_030ce6e42da3 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-reconciler/src/ReactProfilerTimer.js lines 200–246

export function startHostActionTimer(fiber: Fiber): void {
  if (!enableProfilerTimer || !enableComponentPerformanceTrack) {
    return;
  }
  // This schedules an update on both the blocking lane for the pending state and on the
  // transition lane for the action update. Using the debug task from the host fiber.
  if (blockingUpdateTime < 0) {
    blockingUpdateTime = now();
    blockingUpdateTask =
      __DEV__ && fiber._debugTask != null ? fiber._debugTask : null;
    if (isAlreadyRendering()) {
      blockingUpdateType = SPAWNED_UPDATE;
    }
    const newEventTime = resolveEventTimeStamp();
    const newEventType = resolveEventType();
    if (
      newEventTime !== blockingEventRepeatTime ||
      newEventType !== blockingEventType
    ) {
      blockingEventRepeatTime = -1.1;
    } else if (newEventType !== null) {
      // If this is a second update in the same event, we treat it as a spawned update.
      // This might be a microtask spawned from useEffect, multiple flushSync or
      // a setState in a microtask spawned after the first setState. Regardless it's bad.
      blockingUpdateType = SPAWNED_UPDATE;
    }
    blockingEventTime = newEventTime;
    blockingEventType = newEventType;
  }
  if (transitionUpdateTime < 0) {
    transitionUpdateTime = now();
    transitionUpdateTask =
      __DEV__ && fiber._debugTask != null ? fiber._debugTask : null;
    if (transitionStartTime < 0) {
      const newEventTime = resolveEventTimeStamp();
      const newEventType = resolveEventType();
      if (
        newEventTime !== transitionEventRepeatTime ||
        newEventType !== transitionEventType
      ) {
        transitionEventRepeatTime = -1.1;
      }
      transitionEventTime = newEventTime;
      transitionEventType = newEventType;
    }
  }
}

Domain

Subdomains

Frequently Asked Questions

What does startHostActionTimer() do?
startHostActionTimer() is a function in the react codebase, defined in packages/react-reconciler/src/ReactProfilerTimer.js.
Where is startHostActionTimer() defined?
startHostActionTimer() is defined in packages/react-reconciler/src/ReactProfilerTimer.js at line 200.

Analyze Your Own Codebase

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

Try Supermodel Free