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

Function ReactFiberBeginWork

code/dependency-injection/public/app.js:9827–10639  ·  view source on GitHub ↗
(config, hostContext, legacyContext, newContext, hydrationContext, scheduleWork, computeExpirationForFiber)

Source from the content-addressed store, hash-verified

9825}
9826
9827var ReactFiberBeginWork = function (config, hostContext, legacyContext, newContext, hydrationContext, scheduleWork, computeExpirationForFiber) {
9828 var shouldSetTextContent = config.shouldSetTextContent,
9829 shouldDeprioritizeSubtree = config.shouldDeprioritizeSubtree;
9830 var pushHostContext = hostContext.pushHostContext,
9831 pushHostContainer = hostContext.pushHostContainer;
9832 var pushProvider = newContext.pushProvider;
9833 var getMaskedContext = legacyContext.getMaskedContext,
9834 getUnmaskedContext = legacyContext.getUnmaskedContext,
9835 hasLegacyContextChanged = legacyContext.hasContextChanged,
9836 pushLegacyContextProvider = legacyContext.pushContextProvider,
9837 pushTopLevelContextObject = legacyContext.pushTopLevelContextObject,
9838 invalidateContextProvider = legacyContext.invalidateContextProvider;
9839 var enterHydrationState = hydrationContext.enterHydrationState,
9840 resetHydrationState = hydrationContext.resetHydrationState,
9841 tryToClaimNextHydratableInstance = hydrationContext.tryToClaimNextHydratableInstance;
9842
9843 var _ReactFiberClassCompo = ReactFiberClassComponent(legacyContext, scheduleWork, computeExpirationForFiber, memoizeProps, memoizeState),
9844 adoptClassInstance = _ReactFiberClassCompo.adoptClassInstance,
9845 callGetDerivedStateFromProps = _ReactFiberClassCompo.callGetDerivedStateFromProps,
9846 constructClassInstance = _ReactFiberClassCompo.constructClassInstance,
9847 mountClassInstance = _ReactFiberClassCompo.mountClassInstance,
9848 resumeMountClassInstance = _ReactFiberClassCompo.resumeMountClassInstance,
9849 updateClassInstance = _ReactFiberClassCompo.updateClassInstance;
9850
9851 // TODO: Remove this and use reconcileChildrenAtExpirationTime directly.
9852
9853
9854 function reconcileChildren(current, workInProgress, nextChildren) {
9855 reconcileChildrenAtExpirationTime(current, workInProgress, nextChildren, workInProgress.expirationTime);
9856 }
9857
9858 function reconcileChildrenAtExpirationTime(current, workInProgress, nextChildren, renderExpirationTime) {
9859 if (current === null) {
9860 // If this is a fresh new component that hasn't been rendered yet, we
9861 // won't update its child set by applying minimal side-effects. Instead,
9862 // we will add them all to the child before it gets rendered. That means
9863 // we can optimize this reconciliation pass by not tracking side-effects.
9864 workInProgress.child = mountChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
9865 } else {
9866 // If the current child is the same as the work in progress, it means that
9867 // we haven't yet started any work on these children. Therefore, we use
9868 // the clone algorithm to create a copy of all the current children.
9869
9870 // If we had any progressed work already, that is invalid at this point so
9871 // let's throw it out.
9872 workInProgress.child = reconcileChildFibers(workInProgress, current.child, nextChildren, renderExpirationTime);
9873 }
9874 }
9875
9876 function updateForwardRef(current, workInProgress) {
9877 var render = workInProgress.type.render;
9878 var nextChildren = render(workInProgress.pendingProps, workInProgress.ref);
9879 reconcileChildren(current, workInProgress, nextChildren);
9880 memoizeProps(workInProgress, nextChildren);
9881 return workInProgress.child;
9882 }
9883
9884 function updateFragment(current, workInProgress) {

Callers 1

ReactFiberSchedulerFunction · 0.70

Calls 1

ReactFiberClassComponentFunction · 0.70

Tested by

no test coverage detected