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

Function ReactFiberBeginWork

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

Source from the content-addressed store, hash-verified

9767}
9768
9769var ReactFiberBeginWork = function (config, hostContext, legacyContext, newContext, hydrationContext, scheduleWork, computeExpirationForFiber) {
9770 var shouldSetTextContent = config.shouldSetTextContent,
9771 shouldDeprioritizeSubtree = config.shouldDeprioritizeSubtree;
9772 var pushHostContext = hostContext.pushHostContext,
9773 pushHostContainer = hostContext.pushHostContainer;
9774 var pushProvider = newContext.pushProvider;
9775 var getMaskedContext = legacyContext.getMaskedContext,
9776 getUnmaskedContext = legacyContext.getUnmaskedContext,
9777 hasLegacyContextChanged = legacyContext.hasContextChanged,
9778 pushLegacyContextProvider = legacyContext.pushContextProvider,
9779 pushTopLevelContextObject = legacyContext.pushTopLevelContextObject,
9780 invalidateContextProvider = legacyContext.invalidateContextProvider;
9781 var enterHydrationState = hydrationContext.enterHydrationState,
9782 resetHydrationState = hydrationContext.resetHydrationState,
9783 tryToClaimNextHydratableInstance = hydrationContext.tryToClaimNextHydratableInstance;
9784
9785 var _ReactFiberClassCompo = ReactFiberClassComponent(legacyContext, scheduleWork, computeExpirationForFiber, memoizeProps, memoizeState),
9786 adoptClassInstance = _ReactFiberClassCompo.adoptClassInstance,
9787 callGetDerivedStateFromProps = _ReactFiberClassCompo.callGetDerivedStateFromProps,
9788 constructClassInstance = _ReactFiberClassCompo.constructClassInstance,
9789 mountClassInstance = _ReactFiberClassCompo.mountClassInstance,
9790 resumeMountClassInstance = _ReactFiberClassCompo.resumeMountClassInstance,
9791 updateClassInstance = _ReactFiberClassCompo.updateClassInstance;
9792
9793 // TODO: Remove this and use reconcileChildrenAtExpirationTime directly.
9794
9795
9796 function reconcileChildren(current, workInProgress, nextChildren) {
9797 reconcileChildrenAtExpirationTime(current, workInProgress, nextChildren, workInProgress.expirationTime);
9798 }
9799
9800 function reconcileChildrenAtExpirationTime(current, workInProgress, nextChildren, renderExpirationTime) {
9801 if (current === null) {
9802 // If this is a fresh new component that hasn't been rendered yet, we
9803 // won't update its child set by applying minimal side-effects. Instead,
9804 // we will add them all to the child before it gets rendered. That means
9805 // we can optimize this reconciliation pass by not tracking side-effects.
9806 workInProgress.child = mountChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
9807 } else {
9808 // If the current child is the same as the work in progress, it means that
9809 // we haven't yet started any work on these children. Therefore, we use
9810 // the clone algorithm to create a copy of all the current children.
9811
9812 // If we had any progressed work already, that is invalid at this point so
9813 // let's throw it out.
9814 workInProgress.child = reconcileChildFibers(workInProgress, current.child, nextChildren, renderExpirationTime);
9815 }
9816 }
9817
9818 function updateForwardRef(current, workInProgress) {
9819 var render = workInProgress.type.render;
9820 var nextChildren = render(workInProgress.pendingProps, workInProgress.ref);
9821 reconcileChildren(current, workInProgress, nextChildren);
9822 memoizeProps(workInProgress, nextChildren);
9823 return workInProgress.child;
9824 }
9825
9826 function updateFragment(current, workInProgress) {

Callers 1

ReactFiberSchedulerFunction · 0.70

Calls 1

ReactFiberClassComponentFunction · 0.70

Tested by

no test coverage detected