MCPcopy Create free account
hub / github.com/danielstocks/react-sortable / completeUnitOfWork

Function completeUnitOfWork

bundle.js:7763–7788  ·  view source on GitHub ↗
(workInProgress)

Source from the content-addressed store, hash-verified

7761var newPriority=getUpdatePriority$1(workInProgress);// TODO: Coroutines need to visit stateNode
7762var child=workInProgress.child;while(child!==null){// Ensure that remaining work priority bubbles up.
7763newPriority=largerPriority$1(newPriority,child.pendingWorkPriority);child=child.sibling;}workInProgress.pendingWorkPriority=newPriority;}function completeUnitOfWork(workInProgress){while(true){// The current, flushed, state of this fiber is the alternate.
7764// Ideally nothing should rely on this, but relying on it here
7765// means that we don't need an additional field on the work in
7766// progress.
7767var current=workInProgress.alternate;var next=completeWork(current,workInProgress,nextPriorityLevel);var returnFiber=workInProgress['return'];var siblingFiber=workInProgress.sibling;resetWorkPriority(workInProgress,nextPriorityLevel);if(next!==null){{stopWorkTimer(workInProgress);}if(true&&ReactFiberInstrumentation$1.debugTool){ReactFiberInstrumentation$1.debugTool.onCompleteWork(workInProgress);}// If completing this work spawned new work, do that next. We'll come
7768// back here again.
7769return next;}if(returnFiber!==null){// Append all the effects of the subtree and this fiber onto the effect
7770// list of the parent. The completion order of the children affects the
7771// side-effect order.
7772if(returnFiber.firstEffect===null){returnFiber.firstEffect=workInProgress.firstEffect;}if(workInProgress.lastEffect!==null){if(returnFiber.lastEffect!==null){returnFiber.lastEffect.nextEffect=workInProgress.firstEffect;}returnFiber.lastEffect=workInProgress.lastEffect;}// If this fiber had side-effects, we append it AFTER the children's
7773// side-effects. We can perform certain side-effects earlier if
7774// needed, by doing multiple passes over the effect list. We don't want
7775// to schedule our own side-effect on our own list because if end up
7776// reusing children we'll schedule this effect onto itself since we're
7777// at the end.
7778var effectTag=workInProgress.effectTag;// Skip both NoWork and PerformedWork tags when creating the effect list.
7779// PerformedWork effect is read by React DevTools but shouldn't be committed.
7780if(effectTag>PerformedWork){if(returnFiber.lastEffect!==null){returnFiber.lastEffect.nextEffect=workInProgress;}else{returnFiber.firstEffect=workInProgress;}returnFiber.lastEffect=workInProgress;}}{stopWorkTimer(workInProgress);}if(true&&ReactFiberInstrumentation$1.debugTool){ReactFiberInstrumentation$1.debugTool.onCompleteWork(workInProgress);}if(siblingFiber!==null){// If there is more work to do in this returnFiber, do that next.
7781return siblingFiber;}else if(returnFiber!==null){// If there's no more work in this returnFiber. Complete the returnFiber.
7782workInProgress=returnFiber;continue;}else{// We've reached the root. Mark the root as pending commit. Depending
7783// on how much time we have left, we'll either commit it now or in
7784// the next frame.
7785pendingCommit=workInProgress;return null;}}// Without this explicit null return Flow complains of invalid return type
7786// TODO Remove the above while(true) loop
7787// eslint-disable-next-line no-unreachable
7788return null;}function performUnitOfWork(workInProgress){// The current, flushed, state of this fiber is the alternate.
7789// Ideally nothing should rely on this, but relying on it here
7790// means that we don't need an additional field on the work in
7791// progress.

Callers 2

performUnitOfWorkFunction · 0.85
performFailedUnitOfWorkFunction · 0.85

Calls 2

completeWorkFunction · 0.85
resetWorkPriorityFunction · 0.85

Tested by

no test coverage detected