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

Function ReactFiberBeginWork

code/third-party/public/app.js:8967–9779  ·  view source on GitHub ↗
(config, hostContext, legacyContext, newContext, hydrationContext, scheduleWork, computeExpirationForFiber)

Source from the content-addressed store, hash-verified

8965}
8966
8967var ReactFiberBeginWork = function (config, hostContext, legacyContext, newContext, hydrationContext, scheduleWork, computeExpirationForFiber) {
8968 var shouldSetTextContent = config.shouldSetTextContent,
8969 shouldDeprioritizeSubtree = config.shouldDeprioritizeSubtree;
8970 var pushHostContext = hostContext.pushHostContext,
8971 pushHostContainer = hostContext.pushHostContainer;
8972 var pushProvider = newContext.pushProvider;
8973 var getMaskedContext = legacyContext.getMaskedContext,
8974 getUnmaskedContext = legacyContext.getUnmaskedContext,
8975 hasLegacyContextChanged = legacyContext.hasContextChanged,
8976 pushLegacyContextProvider = legacyContext.pushContextProvider,
8977 pushTopLevelContextObject = legacyContext.pushTopLevelContextObject,
8978 invalidateContextProvider = legacyContext.invalidateContextProvider;
8979 var enterHydrationState = hydrationContext.enterHydrationState,
8980 resetHydrationState = hydrationContext.resetHydrationState,
8981 tryToClaimNextHydratableInstance = hydrationContext.tryToClaimNextHydratableInstance;
8982
8983 var _ReactFiberClassCompo = ReactFiberClassComponent(legacyContext, scheduleWork, computeExpirationForFiber, memoizeProps, memoizeState),
8984 adoptClassInstance = _ReactFiberClassCompo.adoptClassInstance,
8985 callGetDerivedStateFromProps = _ReactFiberClassCompo.callGetDerivedStateFromProps,
8986 constructClassInstance = _ReactFiberClassCompo.constructClassInstance,
8987 mountClassInstance = _ReactFiberClassCompo.mountClassInstance,
8988 resumeMountClassInstance = _ReactFiberClassCompo.resumeMountClassInstance,
8989 updateClassInstance = _ReactFiberClassCompo.updateClassInstance;
8990
8991 // TODO: Remove this and use reconcileChildrenAtExpirationTime directly.
8992
8993
8994 function reconcileChildren(current, workInProgress, nextChildren) {
8995 reconcileChildrenAtExpirationTime(current, workInProgress, nextChildren, workInProgress.expirationTime);
8996 }
8997
8998 function reconcileChildrenAtExpirationTime(current, workInProgress, nextChildren, renderExpirationTime) {
8999 if (current === null) {
9000 // If this is a fresh new component that hasn't been rendered yet, we
9001 // won't update its child set by applying minimal side-effects. Instead,
9002 // we will add them all to the child before it gets rendered. That means
9003 // we can optimize this reconciliation pass by not tracking side-effects.
9004 workInProgress.child = mountChildFibers(workInProgress, null, nextChildren, renderExpirationTime);
9005 } else {
9006 // If the current child is the same as the work in progress, it means that
9007 // we haven't yet started any work on these children. Therefore, we use
9008 // the clone algorithm to create a copy of all the current children.
9009
9010 // If we had any progressed work already, that is invalid at this point so
9011 // let's throw it out.
9012 workInProgress.child = reconcileChildFibers(workInProgress, current.child, nextChildren, renderExpirationTime);
9013 }
9014 }
9015
9016 function updateForwardRef(current, workInProgress) {
9017 var render = workInProgress.type.render;
9018 var nextChildren = render(workInProgress.pendingProps, workInProgress.ref);
9019 reconcileChildren(current, workInProgress, nextChildren);
9020 memoizeProps(workInProgress, nextChildren);
9021 return workInProgress.child;
9022 }
9023
9024 function updateFragment(current, workInProgress) {

Callers 1

ReactFiberSchedulerFunction · 0.70

Calls 1

ReactFiberClassComponentFunction · 0.70

Tested by

no test coverage detected