MCPcopy
hub / github.com/plotly/dash / completeUnitOfWork

Function completeUnitOfWork

dash/deps/react-dom@18.2.0.js:26586–26681  ·  view source on GitHub ↗
(unitOfWork)

Source from the content-addressed store, hash-verified

26584 }
26585
26586 function completeUnitOfWork(unitOfWork) {
26587 // Attempt to complete the current unit of work, then move to the next
26588 // sibling. If there are no more siblings, return to the parent fiber.
26589 var completedWork = unitOfWork;
26590
26591 do {
26592 // The current, flushed, state of this fiber is the alternate. Ideally
26593 // nothing should rely on this, but relying on it here means that we don't
26594 // need an additional field on the work in progress.
26595 var current = completedWork.alternate;
26596 var returnFiber = completedWork.return; // Check if the work completed or if something threw.
26597
26598 if ((completedWork.flags & Incomplete) === NoFlags) {
26599 setCurrentFiber(completedWork);
26600 var next = void 0;
26601
26602 if ( (completedWork.mode & ProfileMode) === NoMode) {
26603 next = completeWork(current, completedWork, subtreeRenderLanes);
26604 } else {
26605 startProfilerTimer(completedWork);
26606 next = completeWork(current, completedWork, subtreeRenderLanes); // Update render duration assuming we didn't error.
26607
26608 stopProfilerTimerIfRunningAndRecordDelta(completedWork, false);
26609 }
26610
26611 resetCurrentFiber();
26612
26613 if (next !== null) {
26614 // Completing this fiber spawned new work. Work on that next.
26615 workInProgress = next;
26616 return;
26617 }
26618 } else {
26619 // This fiber did not complete because something threw. Pop values off
26620 // the stack without entering the complete phase. If this is a boundary,
26621 // capture values if possible.
26622 var _next = unwindWork(current, completedWork); // Because this fiber did not complete, don't reset its lanes.
26623
26624
26625 if (_next !== null) {
26626 // If completing this work spawned new work, do that next. We'll come
26627 // back here again.
26628 // Since we're restarting, remove anything that is not a host effect
26629 // from the effect tag.
26630 _next.flags &= HostEffectMask;
26631 workInProgress = _next;
26632 return;
26633 }
26634
26635 if ( (completedWork.mode & ProfileMode) !== NoMode) {
26636 // Record the render duration for the fiber that errored.
26637 stopProfilerTimerIfRunningAndRecordDelta(completedWork, false); // Include the time spent working on failed children before continuing.
26638
26639 var actualDuration = completedWork.actualDuration;
26640 var child = completedWork.child;
26641
26642 while (child !== null) {
26643 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…