MCPcopy Create free account
hub / github.com/microsoft/SandDance / performUnitOfWork

Function performUnitOfWork

docs/external/js/react-dom.development.js:22278–22305  ·  view source on GitHub ↗
(unitOfWork)

Source from the content-addressed store, hash-verified

22276 }
22277
22278 function performUnitOfWork(unitOfWork) {
22279 // The current, flushed, state of this fiber is the alternate. Ideally
22280 // nothing should rely on this, but relying on it here means that we don't
22281 // need an additional field on the work in progress.
22282 var current = unitOfWork.alternate;
22283 startWorkTimer(unitOfWork);
22284 setCurrentFiber(unitOfWork);
22285 var next;
22286
22287 if ( (unitOfWork.mode & ProfileMode) !== NoMode) {
22288 startProfilerTimer(unitOfWork);
22289 next = beginWork$1(current, unitOfWork, renderExpirationTime$1);
22290 stopProfilerTimerIfRunningAndRecordDelta(unitOfWork, true);
22291 } else {
22292 next = beginWork$1(current, unitOfWork, renderExpirationTime$1);
22293 }
22294
22295 resetCurrentFiber();
22296 unitOfWork.memoizedProps = unitOfWork.pendingProps;
22297
22298 if (next === null) {
22299 // If this doesn't spawn new work, complete the current work.
22300 next = completeUnitOfWork(unitOfWork);
22301 }
22302
22303 ReactCurrentOwner$2.current = null;
22304 return next;
22305 }
22306
22307 function completeUnitOfWork(unitOfWork) {
22308 // Attempt to complete the current unit of work, then move to the next

Callers 2

workLoopSyncFunction · 0.85
workLoopConcurrentFunction · 0.85

Calls 6

startWorkTimerFunction · 0.85
setCurrentFiberFunction · 0.85
startProfilerTimerFunction · 0.85
resetCurrentFiberFunction · 0.85
completeUnitOfWorkFunction · 0.85

Tested by

no test coverage detected