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

Function createWorkInProgress

code/dependency-injection/public/app.js:6994–7041  ·  view source on GitHub ↗
(current, pendingProps, expirationTime)

Source from the content-addressed store, hash-verified

6992
6993// This is used to create an alternate fiber to do work on.
6994function createWorkInProgress(current, pendingProps, expirationTime) {
6995 var workInProgress = current.alternate;
6996 if (workInProgress === null) {
6997 // We use a double buffering pooling technique because we know that we'll
6998 // only ever need at most two versions of a tree. We pool the "other" unused
6999 // node that we're free to reuse. This is lazily created to avoid allocating
7000 // extra objects for things that are never updated. It also allow us to
7001 // reclaim the extra memory if needed.
7002 workInProgress = createFiber(current.tag, pendingProps, current.key, current.mode);
7003 workInProgress.type = current.type;
7004 workInProgress.stateNode = current.stateNode;
7005
7006 {
7007 // DEV-only fields
7008 workInProgress._debugID = current._debugID;
7009 workInProgress._debugSource = current._debugSource;
7010 workInProgress._debugOwner = current._debugOwner;
7011 }
7012
7013 workInProgress.alternate = current;
7014 current.alternate = workInProgress;
7015 } else {
7016 workInProgress.pendingProps = pendingProps;
7017
7018 // We already have an alternate.
7019 // Reset the effect tag.
7020 workInProgress.effectTag = NoEffect;
7021
7022 // The effect list is no longer valid.
7023 workInProgress.nextEffect = null;
7024 workInProgress.firstEffect = null;
7025 workInProgress.lastEffect = null;
7026 }
7027
7028 workInProgress.expirationTime = expirationTime;
7029
7030 workInProgress.child = current.child;
7031 workInProgress.memoizedProps = current.memoizedProps;
7032 workInProgress.memoizedState = current.memoizedState;
7033 workInProgress.updateQueue = current.updateQueue;
7034
7035 // These will be overridden during the parent's reconciliation
7036 workInProgress.sibling = current.sibling;
7037 workInProgress.index = current.index;
7038 workInProgress.ref = current.ref;
7039
7040 return workInProgress;
7041}
7042
7043function createHostRootFiber(isAsync) {
7044 var mode = isAsync ? AsyncMode | StrictMode : NoContext;

Callers 3

useFiberFunction · 0.70
cloneChildFibersFunction · 0.70
renderRootFunction · 0.70

Calls 1

createFiberFunction · 0.70

Tested by

no test coverage detected