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

Function scheduleUpdateImpl

bundle.js:7919–7933  ·  view source on GitHub ↗
(fiber,priorityLevel,isErrorRecovery)

Source from the content-addressed store, hash-verified

7917firstUncaughtError=capturedError.error;}return;default:invariant(false,'Invalid type of work. This error is likely caused by a bug in React. Please file an issue.');}}function unwindContexts(from,to){var node=from;while(node!==null){switch(node.tag){case ClassComponent$5:popContextProvider$1(node);break;case HostComponent$6:popHostContext(node);break;case HostRoot$6:popHostContainer(node);break;case HostPortal$3:popHostContainer(node);break;}if(node===to||node.alternate===to){{stopFailedWorkTimer(node);}break;}else{stopWorkTimer(node);}node=node['return'];}}function scheduleRoot(root,priorityLevel){if(priorityLevel===NoWork$2){return;}if(!root.isScheduled){root.isScheduled=true;if(lastScheduledRoot){// Schedule ourselves to the end.
7918lastScheduledRoot.nextScheduledRoot=root;lastScheduledRoot=root;}else{// We're the only work scheduled.
7919nextScheduledRoot=root;lastScheduledRoot=root;}}}function scheduleUpdate(fiber,priorityLevel){return scheduleUpdateImpl(fiber,priorityLevel,false);}function scheduleUpdateImpl(fiber,priorityLevel,isErrorRecovery){{recordScheduleUpdate();}if(nestedUpdateCount>NESTED_UPDATE_LIMIT){didFatal=true;invariant(false,'Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops.');}if(!isPerformingWork&&priorityLevel<=nextPriorityLevel){// We must reset the current unit of work pointer so that we restart the
7920// search from the root during the next tick, in case there is now higher
7921// priority work somewhere earlier than before.
7922nextUnitOfWork=null;}{if(!isErrorRecovery&&fiber.tag===ClassComponent$5){var instance=fiber.stateNode;warnAboutInvalidUpdates(instance);}}var node=fiber;var shouldContinue=true;while(node!==null&&shouldContinue){// Walk the parent path to the root and update each node's priority. Once
7923// we reach a node whose priority matches (and whose alternate's priority
7924// matches) we can exit safely knowing that the rest of the path is correct.
7925shouldContinue=false;if(node.pendingWorkPriority===NoWork$2||node.pendingWorkPriority>priorityLevel){// Priority did not match. Update and keep going.
7926shouldContinue=true;node.pendingWorkPriority=priorityLevel;}if(node.alternate!==null){if(node.alternate.pendingWorkPriority===NoWork$2||node.alternate.pendingWorkPriority>priorityLevel){// Priority did not match. Update and keep going.
7927shouldContinue=true;node.alternate.pendingWorkPriority=priorityLevel;}}if(node['return']===null){if(node.tag===HostRoot$6){var root=node.stateNode;scheduleRoot(root,priorityLevel);if(!isPerformingWork){switch(priorityLevel){case SynchronousPriority$1:// Perform this update now.
7928if(isUnbatchingUpdates){// We're inside unbatchedUpdates, which is inside either
7929// batchedUpdates or a lifecycle. We should only flush
7930// synchronous work, not task work.
7931performWork(SynchronousPriority$1,null);}else{// Flush both synchronous and task work.
7932performWork(TaskPriority$1,null);}break;case TaskPriority$1:!isBatchingUpdates?invariant(false,'Task updates can only be scheduled as a nested update or inside batchedUpdates.'):void 0;break;default:// Schedule a callback to perform the work later.
7933if(!isCallbackScheduled){scheduleDeferredCallback(performDeferredWork);isCallbackScheduled=true;}}}}else{{if(!isErrorRecovery&&fiber.tag===ClassComponent$5){warnAboutUpdateOnUnmounted(fiber.stateNode);}}return;}}node=node['return'];}}function getPriorityContext(fiber,forceAsync){var priorityLevel=priorityContext;if(priorityLevel===NoWork$2){if(!useSyncScheduling||fiber.internalContextTag&AsyncUpdates||forceAsync){priorityLevel=LowPriority;}else{priorityLevel=SynchronousPriority$1;}}// If we're in a batch, or if we're already performing work, downgrade sync
7934// priority to task priority
7935if(priorityLevel===SynchronousPriority$1&&(isPerformingWork||isBatchingUpdates)){return TaskPriority$1;}return priorityLevel;}function scheduleErrorRecovery(fiber){scheduleUpdateImpl(fiber,TaskPriority$1,true);}function batchedUpdates(fn,a){var previousIsBatchingUpdates=isBatchingUpdates;isBatchingUpdates=true;try{return fn(a);}finally{isBatchingUpdates=previousIsBatchingUpdates;// If we're not already inside a batch, we need to flush any task work
7936// that was created by the user-provided function.

Callers 2

scheduleUpdateFunction · 0.85
scheduleErrorRecoveryFunction · 0.85

Calls 5

warnAboutInvalidUpdatesFunction · 0.85
scheduleRootFunction · 0.85
performWorkFunction · 0.85
invariantFunction · 0.70

Tested by

no test coverage detected