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

Function ReactFiberBeginWork

code/styling/public/app.js:9734–10546  ·  view source on GitHub ↗
(config, hostContext, legacyContext, newContext, hydrationContext, scheduleWork, computeExpirationForFiber)

Source from the content-addressed store, hash-verified

9732}
9733
9734var ReactFiberBeginWork = function (config, hostContext, legacyContext, newContext, hydrationContext, scheduleWork, computeExpirationForFiber) {
9735 var shouldSetTextContent = config.shouldSetTextContent,
9736 shouldDeprioritizeSubtree = config.shouldDeprioritizeSubtree;
9737 var pushHostContext = hostContext.pushHostContext,
9738 pushHostContainer = hostContext.pushHostContainer;
9739 var pushProvider = newContext.pushProvider;
9740 var getMaskedContext = legacyContext.getMaskedContext,
9741 getUnmaskedContext = legacyContext.getUnmaskedContext,
9742 hasLegacyContextChanged = legacyContext.hasContextChanged,
9743 pushLegacyContextProvider = legacyContext.pushContextProvider,
9744 pushTopLevelContextObject = legacyContext.pushTopLevelContextObject,
9745 invalidateContextProvider = legacyContext.invalidateContextProvider;
9746 var enterHydrationState = hydrationContext.enterHydrationState,
9747 resetHydrationState = hydrationContext.resetHydrationState,
9748 tryToClaimNextHydratableInstance = hydrationContext.tryToClaimNextHydratableInstance;
9749
9750 var _ReactFiberClassCompo = ReactFiberClassComponent(legacyContext, scheduleWork, computeExpirationForFiber, memoizeProps, memoizeState),
9751 adoptClassInstance = _ReactFiberClassCompo.adoptClassInstance,
9752 callGetDerivedStateFromProps = _ReactFiberClassCompo.callGetDerivedStateFromProps,
9753 constructClassInstance = _ReactFiberClassCompo.constructClassInstance,
9754 mountClassInstance = _ReactFiberClassCompo.mountClassInstance,
9755 resumeMountClassInstance = _ReactFiberClassCompo.resumeMountClassInstance,
9756 updateClassInstance = _ReactFiberClassCompo.updateClassInstance;
9757
9758 // TODO: Remove this and use reconcileChildrenAtExpirationTime directly.
9759
9760
9761 function reconcileChildren(current, workInProgress, nextChildren) {
9762 reconcileChildrenAtExpirationTime(current, workInProgress, nextChildren, workInProgress.expirationTime);
9763 }
9764
9765 function reconcileChildrenAtExpirationTime(current, workInProgress, nextChildren, renderExpirationTime) {
9766 if (current === null) {
9767 // If this is a fresh new component that hasn't been rendered yet, we
9768 // won't update its child set by applying minimal side-effects. Instead,
9769 // we will add them all to the child before it gets rendered. That means
9770 // we can optimize this reconciliation pass by not tracking side-effects.
9771 workInProgress.child = mountChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
9772 } else {
9773 // If the current child is the same as the work in progress, it means that
9774 // we haven't yet started any work on these children. Therefore, we use
9775 // the clone algorithm to create a copy of all the current children.
9776
9777 // If we had any progressed work already, that is invalid at this point so
9778 // let's throw it out.
9779 workInProgress.child = reconcileChildFibers(workInProgress, current.child, nextChildren, renderExpirationTime);
9780 }
9781 }
9782
9783 function updateForwardRef(current, workInProgress) {
9784 var render = workInProgress.type.render;
9785 var nextChildren = render(workInProgress.pendingProps, workInProgress.ref);
9786 reconcileChildren(current, workInProgress, nextChildren);
9787 memoizeProps(workInProgress, nextChildren);
9788 return workInProgress.child;
9789 }
9790
9791 function updateFragment(current, workInProgress) {

Callers 1

ReactFiberSchedulerFunction · 0.70

Calls 1

ReactFiberClassComponentFunction · 0.70

Tested by

no test coverage detected