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

Function resetNextUnitOfWork

bundle.js:7697–7711  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

7695// after the workLoop exits, so never call resetNextUnitOfWork from outside
7696// the work loop.
7697function resetNextUnitOfWork(){// Clear out roots with no more work on them, or if they have uncaught errors
7698while(nextScheduledRoot!==null&&nextScheduledRoot.current.pendingWorkPriority===NoWork$2){// Unschedule this root.
7699nextScheduledRoot.isScheduled=false;// Read the next pointer now.
7700// We need to clear it in case this root gets scheduled again later.
7701var next=nextScheduledRoot.nextScheduledRoot;nextScheduledRoot.nextScheduledRoot=null;// Exit if we cleared all the roots and there's no work to do.
7702if(nextScheduledRoot===lastScheduledRoot){nextScheduledRoot=null;lastScheduledRoot=null;nextPriorityLevel=NoWork$2;return null;}// Continue with the next root.
7703// If there's no work on it, it will get unscheduled too.
7704nextScheduledRoot=next;}var root=nextScheduledRoot;var highestPriorityRoot=null;var highestPriorityLevel=NoWork$2;while(root!==null){if(root.current.pendingWorkPriority!==NoWork$2&&(highestPriorityLevel===NoWork$2||highestPriorityLevel>root.current.pendingWorkPriority)){highestPriorityLevel=root.current.pendingWorkPriority;highestPriorityRoot=root;}// We didn't find anything to do in this root, so let's try the next one.
7705root=root.nextScheduledRoot;}if(highestPriorityRoot!==null){nextPriorityLevel=highestPriorityLevel;// Before we start any new work, let's make sure that we have a fresh
7706// stack to work from.
7707// TODO: This call is buried a bit too deep. It would be nice to have
7708// a single point which happens right before any new work and
7709// unfortunately this is it.
7710resetContextStack();nextUnitOfWork=createWorkInProgress$1(highestPriorityRoot.current,highestPriorityLevel);if(highestPriorityRoot!==nextRenderedTree){// We've switched trees. Reset the nested update counter.
7711nestedUpdateCount=0;nextRenderedTree=highestPriorityRoot;}return;}nextPriorityLevel=NoWork$2;nextUnitOfWork=null;nextRenderedTree=null;return;}function commitAllHostEffects(){while(nextEffect!==null){{ReactDebugCurrentFiber$3.setCurrentFiber(nextEffect,null);recordEffect();}var effectTag=nextEffect.effectTag;if(effectTag&ContentReset){config.resetTextContent(nextEffect.stateNode);}if(effectTag&Ref){var current=nextEffect.alternate;if(current!==null){commitDetachRef(current);}}// The following switch statement is only concerned about placement,
7712// updates, and deletions. To avoid needing to add a case for every
7713// possible bitmap value, we remove the secondary effects from the
7714// effect tag and switch on that value.

Callers 2

commitAllWorkFunction · 0.85
workLoopFunction · 0.85

Calls 1

resetContextStackFunction · 0.85

Tested by

no test coverage detected