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

Function ReactFiberBeginWork

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

Source from the content-addressed store, hash-verified

9983}
9984
9985var ReactFiberBeginWork = function (config, hostContext, legacyContext, newContext, hydrationContext, scheduleWork, computeExpirationForFiber) {
9986 var shouldSetTextContent = config.shouldSetTextContent,
9987 shouldDeprioritizeSubtree = config.shouldDeprioritizeSubtree;
9988 var pushHostContext = hostContext.pushHostContext,
9989 pushHostContainer = hostContext.pushHostContainer;
9990 var pushProvider = newContext.pushProvider;
9991 var getMaskedContext = legacyContext.getMaskedContext,
9992 getUnmaskedContext = legacyContext.getUnmaskedContext,
9993 hasLegacyContextChanged = legacyContext.hasContextChanged,
9994 pushLegacyContextProvider = legacyContext.pushContextProvider,
9995 pushTopLevelContextObject = legacyContext.pushTopLevelContextObject,
9996 invalidateContextProvider = legacyContext.invalidateContextProvider;
9997 var enterHydrationState = hydrationContext.enterHydrationState,
9998 resetHydrationState = hydrationContext.resetHydrationState,
9999 tryToClaimNextHydratableInstance = hydrationContext.tryToClaimNextHydratableInstance;
10000
10001 var _ReactFiberClassCompo = ReactFiberClassComponent(legacyContext, scheduleWork, computeExpirationForFiber, memoizeProps, memoizeState),
10002 adoptClassInstance = _ReactFiberClassCompo.adoptClassInstance,
10003 callGetDerivedStateFromProps = _ReactFiberClassCompo.callGetDerivedStateFromProps,
10004 constructClassInstance = _ReactFiberClassCompo.constructClassInstance,
10005 mountClassInstance = _ReactFiberClassCompo.mountClassInstance,
10006 resumeMountClassInstance = _ReactFiberClassCompo.resumeMountClassInstance,
10007 updateClassInstance = _ReactFiberClassCompo.updateClassInstance;
10008
10009 // TODO: Remove this and use reconcileChildrenAtExpirationTime directly.
10010
10011
10012 function reconcileChildren(current, workInProgress, nextChildren) {
10013 reconcileChildrenAtExpirationTime(current, workInProgress, nextChildren, workInProgress.expirationTime);
10014 }
10015
10016 function reconcileChildrenAtExpirationTime(current, workInProgress, nextChildren, renderExpirationTime) {
10017 if (current === null) {
10018 // If this is a fresh new component that hasn't been rendered yet, we
10019 // won't update its child set by applying minimal side-effects. Instead,
10020 // we will add them all to the child before it gets rendered. That means
10021 // we can optimize this reconciliation pass by not tracking side-effects.
10022 workInProgress.child = mountChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
10023 } else {
10024 // If the current child is the same as the work in progress, it means that
10025 // we haven't yet started any work on these children. Therefore, we use
10026 // the clone algorithm to create a copy of all the current children.
10027
10028 // If we had any progressed work already, that is invalid at this point so
10029 // let's throw it out.
10030 workInProgress.child = reconcileChildFibers(workInProgress, current.child, nextChildren, renderExpirationTime);
10031 }
10032 }
10033
10034 function updateForwardRef(current, workInProgress) {
10035 var render = workInProgress.type.render;
10036 var nextChildren = render(workInProgress.pendingProps, workInProgress.ref);
10037 reconcileChildren(current, workInProgress, nextChildren);
10038 memoizeProps(workInProgress, nextChildren);
10039 return workInProgress.child;
10040 }
10041
10042 function updateFragment(current, workInProgress) {

Callers 1

ReactFiberSchedulerFunction · 0.70

Calls 1

ReactFiberClassComponentFunction · 0.70

Tested by

no test coverage detected