MCPcopy Create free account
hub / github.com/plotly/dash / completeUnitOfWork

Function completeUnitOfWork

dash/deps/react-dom@18.3.1.js:26625–26720  ·  view source on GitHub ↗
(unitOfWork)

Source from the content-addressed store, hash-verified

26623 }
26624
26625 function completeUnitOfWork(unitOfWork) {
26626 // Attempt to complete the current unit of work, then move to the next
26627 // sibling. If there are no more siblings, return to the parent fiber.
26628 var completedWork = unitOfWork;
26629
26630 do {
26631 // The current, flushed, state of this fiber is the alternate. Ideally
26632 // nothing should rely on this, but relying on it here means that we don't
26633 // need an additional field on the work in progress.
26634 var current = completedWork.alternate;
26635 var returnFiber = completedWork.return; // Check if the work completed or if something threw.
26636
26637 if ((completedWork.flags & Incomplete) === NoFlags) {
26638 setCurrentFiber(completedWork);
26639 var next = void 0;
26640
26641 if ( (completedWork.mode & ProfileMode) === NoMode) {
26642 next = completeWork(current, completedWork, subtreeRenderLanes);
26643 } else {
26644 startProfilerTimer(completedWork);
26645 next = completeWork(current, completedWork, subtreeRenderLanes); // Update render duration assuming we didn't error.
26646
26647 stopProfilerTimerIfRunningAndRecordDelta(completedWork, false);
26648 }
26649
26650 resetCurrentFiber();
26651
26652 if (next !== null) {
26653 // Completing this fiber spawned new work. Work on that next.
26654 workInProgress = next;
26655 return;
26656 }
26657 } else {
26658 // This fiber did not complete because something threw. Pop values off
26659 // the stack without entering the complete phase. If this is a boundary,
26660 // capture values if possible.
26661 var _next = unwindWork(current, completedWork); // Because this fiber did not complete, don't reset its lanes.
26662
26663
26664 if (_next !== null) {
26665 // If completing this work spawned new work, do that next. We'll come
26666 // back here again.
26667 // Since we're restarting, remove anything that is not a host effect
26668 // from the effect tag.
26669 _next.flags &= HostEffectMask;
26670 workInProgress = _next;
26671 return;
26672 }
26673
26674 if ( (completedWork.mode & ProfileMode) !== NoMode) {
26675 // Record the render duration for the fiber that errored.
26676 stopProfilerTimerIfRunningAndRecordDelta(completedWork, false); // Include the time spent working on failed children before continuing.
26677
26678 var actualDuration = completedWork.actualDuration;
26679 var child = completedWork.child;
26680
26681 while (child !== null) {
26682 actualDuration += child.actualDuration;

Callers 2

handleErrorFunction · 0.70
performUnitOfWorkFunction · 0.70

Calls 6

setCurrentFiberFunction · 0.70
completeWorkFunction · 0.70
startProfilerTimerFunction · 0.70
resetCurrentFiberFunction · 0.70
unwindWorkFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…