MCPcopy Index your code
hub / github.com/microsoft/SandDance / beginWork

Function beginWork

docs/external/js/react-dom.development.js:18545–18846  ·  view source on GitHub ↗
(current, workInProgress, renderExpirationTime)

Source from the content-addressed store, hash-verified

18543 }
18544
18545 function beginWork(current, workInProgress, renderExpirationTime) {
18546 var updateExpirationTime = workInProgress.expirationTime;
18547
18548 {
18549 if (workInProgress._debugNeedsRemount && current !== null) {
18550 // This will restart the begin phase with a new fiber.
18551 return remountFiber(current, workInProgress, createFiberFromTypeAndProps(workInProgress.type, workInProgress.key, workInProgress.pendingProps, workInProgress._debugOwner || null, workInProgress.mode, workInProgress.expirationTime));
18552 }
18553 }
18554
18555 if (current !== null) {
18556 var oldProps = current.memoizedProps;
18557 var newProps = workInProgress.pendingProps;
18558
18559 if (oldProps !== newProps || hasContextChanged() || ( // Force a re-render if the implementation changed due to hot reload:
18560 workInProgress.type !== current.type )) {
18561 // If props or context changed, mark the fiber as having performed work.
18562 // This may be unset if the props are determined to be equal later (memo).
18563 didReceiveUpdate = true;
18564 } else if (updateExpirationTime < renderExpirationTime) {
18565 didReceiveUpdate = false; // This fiber does not have any pending work. Bailout without entering
18566 // the begin phase. There's still some bookkeeping we that needs to be done
18567 // in this optimized path, mostly pushing stuff onto the stack.
18568
18569 switch (workInProgress.tag) {
18570 case HostRoot:
18571 pushHostRootContext(workInProgress);
18572 resetHydrationState();
18573 break;
18574
18575 case HostComponent:
18576 pushHostContext(workInProgress);
18577
18578 if (workInProgress.mode & ConcurrentMode && renderExpirationTime !== Never && shouldDeprioritizeSubtree(workInProgress.type, newProps)) {
18579 {
18580 markSpawnedWork(Never);
18581 } // Schedule this fiber to re-render at offscreen priority. Then bailout.
18582
18583
18584 workInProgress.expirationTime = workInProgress.childExpirationTime = Never;
18585 return null;
18586 }
18587
18588 break;
18589
18590 case ClassComponent:
18591 {
18592 var Component = workInProgress.type;
18593
18594 if (isContextProvider(Component)) {
18595 pushContextProvider(workInProgress);
18596 }
18597
18598 break;
18599 }
18600
18601 case HostPortal:
18602 pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo);

Callers 1

Calls 15

remountFiberFunction · 0.85
hasContextChangedFunction · 0.85
pushHostRootContextFunction · 0.85
resetHydrationStateFunction · 0.85
pushHostContextFunction · 0.85
markSpawnedWorkFunction · 0.85
isContextProviderFunction · 0.85
pushContextProviderFunction · 0.85
pushHostContainerFunction · 0.85
pushProviderFunction · 0.85

Tested by

no test coverage detected