MCPcopy Create free account
hub / github.com/krasimir/react-in-patterns / performUnitOfWork

Function performUnitOfWork

code/new-context-api/public/app.js:12577–12610  ·  view source on GitHub ↗
(workInProgress)

Source from the content-addressed store, hash-verified

12575 }
12576
12577 function performUnitOfWork(workInProgress) {
12578 // The current, flushed, state of this fiber is the alternate.
12579 // Ideally nothing should rely on this, but relying on it here
12580 // means that we don't need an additional field on the work in
12581 // progress.
12582 var current = workInProgress.alternate;
12583
12584 // See if beginning this work spawns more work.
12585 startWorkTimer(workInProgress);
12586 {
12587 ReactDebugCurrentFiber.setCurrentFiber(workInProgress);
12588 }
12589
12590 if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) {
12591 stashedWorkInProgressProperties = _assign({}, workInProgress);
12592 }
12593 var next = beginWork(current, workInProgress, nextRenderExpirationTime);
12594
12595 {
12596 ReactDebugCurrentFiber.resetCurrentFiber();
12597 }
12598 if (true && ReactFiberInstrumentation_1.debugTool) {
12599 ReactFiberInstrumentation_1.debugTool.onBeginWork(workInProgress);
12600 }
12601
12602 if (next === null) {
12603 // If this doesn't spawn new work, complete the current work.
12604 next = completeUnitOfWork(workInProgress);
12605 }
12606
12607 ReactCurrentOwner.current = null;
12608
12609 return next;
12610 }
12611
12612 function workLoop(isAsync) {
12613 if (!isAsync) {

Callers 1

workLoopFunction · 0.70

Calls 3

startWorkTimerFunction · 0.70
beginWorkFunction · 0.70
completeUnitOfWorkFunction · 0.70

Tested by

no test coverage detected