Home / Function/ markWorkCompleted() — react Function Reference

markWorkCompleted() — react Function Reference

Architecture documentation for the markWorkCompleted() function in preprocessData.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  1203d9dc_ec70_a8bd_ce18_6268330a6ee9["markWorkCompleted()"]
  a3f7147d_da0b_56dc_ffc9_a9e2bbc4526a["preprocessData.js"]
  1203d9dc_ec70_a8bd_ce18_6268330a6ee9 -->|defined in| a3f7147d_da0b_56dc_ffc9_a9e2bbc4526a
  7e379096_4ef1_e90c_7e2b_b822b6321992["processTimelineEvent()"]
  7e379096_4ef1_e90c_7e2b_b822b6321992 -->|calls| 1203d9dc_ec70_a8bd_ce18_6268330a6ee9
  style 1203d9dc_ec70_a8bd_ce18_6268330a6ee9 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-devtools-timeline/src/import-worker/preprocessData.js lines 180–214

function markWorkCompleted(
  type: ReactMeasureType,
  stopTime: Milliseconds,
  currentProfilerData: TimelineData,
  stack: ProcessorState['measureStack'],
) {
  if (stack.length === 0) {
    console.error(
      'Unexpected type "%s" completed at %sms while stack is empty.',
      type,
      stopTime,
    );
    // Ignore work "completion" user timing mark that doesn't complete anything
    return;
  }

  const last = stack[stack.length - 1];
  if (last.type !== type) {
    console.error(
      'Unexpected type "%s" completed at %sms before "%s" completed.',
      type,
      stopTime,
      last.type,
    );
  }

  // $FlowFixMe[incompatible-use]
  const {measure, startTime} = stack.pop();
  if (!measure) {
    console.error('Could not find matching measure for type "%s".', type);
  }

  // $FlowFixMe[cannot-write] This property should not be writable outside of this function.
  measure.duration = stopTime - startTime;
}

Domain

Subdomains

Frequently Asked Questions

What does markWorkCompleted() do?
markWorkCompleted() is a function in the react codebase, defined in packages/react-devtools-timeline/src/import-worker/preprocessData.js.
Where is markWorkCompleted() defined?
markWorkCompleted() is defined in packages/react-devtools-timeline/src/import-worker/preprocessData.js at line 180.
What calls markWorkCompleted()?
markWorkCompleted() is called by 1 function(s): processTimelineEvent.

Analyze Your Own Codebase

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

Try Supermodel Free