MCPcopy Index your code
hub / github.com/krasimir/react-in-patterns / createWorkInProgress

Function createWorkInProgress

code/composition/public/app.js:7039–7086  ·  view source on GitHub ↗
(current, pendingProps, expirationTime)

Source from the content-addressed store, hash-verified

7037
7038// This is used to create an alternate fiber to do work on.
7039function createWorkInProgress(current, pendingProps, expirationTime) {
7040 var workInProgress = current.alternate;
7041 if (workInProgress === null) {
7042 // We use a double buffering pooling technique because we know that we'll
7043 // only ever need at most two versions of a tree. We pool the "other" unused
7044 // node that we're free to reuse. This is lazily created to avoid allocating
7045 // extra objects for things that are never updated. It also allow us to
7046 // reclaim the extra memory if needed.
7047 workInProgress = createFiber(current.tag, pendingProps, current.key, current.mode);
7048 workInProgress.type = current.type;
7049 workInProgress.stateNode = current.stateNode;
7050
7051 {
7052 // DEV-only fields
7053 workInProgress._debugID = current._debugID;
7054 workInProgress._debugSource = current._debugSource;
7055 workInProgress._debugOwner = current._debugOwner;
7056 }
7057
7058 workInProgress.alternate = current;
7059 current.alternate = workInProgress;
7060 } else {
7061 workInProgress.pendingProps = pendingProps;
7062
7063 // We already have an alternate.
7064 // Reset the effect tag.
7065 workInProgress.effectTag = NoEffect;
7066
7067 // The effect list is no longer valid.
7068 workInProgress.nextEffect = null;
7069 workInProgress.firstEffect = null;
7070 workInProgress.lastEffect = null;
7071 }
7072
7073 workInProgress.expirationTime = expirationTime;
7074
7075 workInProgress.child = current.child;
7076 workInProgress.memoizedProps = current.memoizedProps;
7077 workInProgress.memoizedState = current.memoizedState;
7078 workInProgress.updateQueue = current.updateQueue;
7079
7080 // These will be overridden during the parent's reconciliation
7081 workInProgress.sibling = current.sibling;
7082 workInProgress.index = current.index;
7083 workInProgress.ref = current.ref;
7084
7085 return workInProgress;
7086}
7087
7088function createHostRootFiber(isAsync) {
7089 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