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

Function performWork

bundle.js:7851–7867  ·  view source on GitHub ↗
(minPriorityLevel,deadline)

Source from the content-addressed store, hash-verified

7849// a re-render.
7850nextUnitOfWork=performFailedUnitOfWork(boundary);// Continue working.
7851workLoop(minPriorityLevel,deadline);}function performWork(minPriorityLevel,deadline){{startWorkLoopTimer();}!!isPerformingWork?invariant(false,'performWork was called recursively. This error is likely caused by a bug in React. Please file an issue.'):void 0;isPerformingWork=true;// The priority context changes during the render phase. We'll need to
7852// reset it at the end.
7853var previousPriorityContext=priorityContext;var didError=false;var error=null;{invokeGuardedCallback$1(null,workLoop,null,minPriorityLevel,deadline);if(hasCaughtError()){didError=true;error=clearCaughtError();}}// An error was thrown during the render phase.
7854while(didError){if(didFatal){// This was a fatal error. Don't attempt to recover from it.
7855firstUncaughtError=error;break;}var failedWork=nextUnitOfWork;if(failedWork===null){// An error was thrown but there's no current unit of work. This can
7856// happen during the commit phase if there's a bug in the renderer.
7857didFatal=true;continue;}// "Capture" the error by finding the nearest boundary. If there is no
7858// error boundary, we use the root.
7859var boundary=captureError(failedWork,error);!(boundary!==null)?invariant(false,'Should have found an error boundary. This error is likely caused by a bug in React. Please file an issue.'):void 0;if(didFatal){// The error we just captured was a fatal error. This happens
7860// when the error propagates to the root more than once.
7861continue;}didError=false;error=null;{invokeGuardedCallback$1(null,performWorkCatchBlock,null,failedWork,boundary,minPriorityLevel,deadline);if(hasCaughtError()){didError=true;error=clearCaughtError();continue;}}// We're finished working. Exit the error loop.
7862break;}// Reset the priority context to its previous value.
7863priorityContext=previousPriorityContext;// If we're inside a callback, set this to false, since we just flushed it.
7864if(deadline!==null){isCallbackScheduled=false;}// If there's remaining async work, make sure we schedule another callback.
7865if(nextPriorityLevel>TaskPriority$1&&!isCallbackScheduled){scheduleDeferredCallback(performDeferredWork);isCallbackScheduled=true;}var errorToThrow=firstUncaughtError;// We're done performing work. Time to clean up.
7866isPerformingWork=false;deadlineHasExpired=false;didFatal=false;firstUncaughtError=null;capturedErrors=null;failedBoundaries=null;nextRenderedTree=null;nestedUpdateCount=0;{stopWorkLoopTimer();}// It's safe to throw any unhandled errors.
7867if(errorToThrow!==null){throw errorToThrow;}}// Returns the boundary that captured the error, or null if the error is ignored
7868function captureError(failedWork,error){// It is no longer valid because we exited the user code.
7869ReactCurrentOwner$1.current=null;{ReactDebugCurrentFiber$3.resetCurrentFiber();}// Search for the nearest error boundary.
7870var boundary=null;// Passed to logCapturedError()

Callers 4

performDeferredWorkFunction · 0.85
scheduleUpdateImplFunction · 0.85
batchedUpdatesFunction · 0.85
flushSyncFunction · 0.85

Calls 2

captureErrorFunction · 0.85
invariantFunction · 0.70

Tested by

no test coverage detected