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

Function createWorkInProgress

code/redux/public/app.js:7152–7199  ·  view source on GitHub ↗
(current, pendingProps, expirationTime)

Source from the content-addressed store, hash-verified

7150
7151// This is used to create an alternate fiber to do work on.
7152function createWorkInProgress(current, pendingProps, expirationTime) {
7153 var workInProgress = current.alternate;
7154 if (workInProgress === null) {
7155 // We use a double buffering pooling technique because we know that we'll
7156 // only ever need at most two versions of a tree. We pool the "other" unused
7157 // node that we're free to reuse. This is lazily created to avoid allocating
7158 // extra objects for things that are never updated. It also allow us to
7159 // reclaim the extra memory if needed.
7160 workInProgress = createFiber(current.tag, pendingProps, current.key, current.mode);
7161 workInProgress.type = current.type;
7162 workInProgress.stateNode = current.stateNode;
7163
7164 {
7165 // DEV-only fields
7166 workInProgress._debugID = current._debugID;
7167 workInProgress._debugSource = current._debugSource;
7168 workInProgress._debugOwner = current._debugOwner;
7169 }
7170
7171 workInProgress.alternate = current;
7172 current.alternate = workInProgress;
7173 } else {
7174 workInProgress.pendingProps = pendingProps;
7175
7176 // We already have an alternate.
7177 // Reset the effect tag.
7178 workInProgress.effectTag = NoEffect;
7179
7180 // The effect list is no longer valid.
7181 workInProgress.nextEffect = null;
7182 workInProgress.firstEffect = null;
7183 workInProgress.lastEffect = null;
7184 }
7185
7186 workInProgress.expirationTime = expirationTime;
7187
7188 workInProgress.child = current.child;
7189 workInProgress.memoizedProps = current.memoizedProps;
7190 workInProgress.memoizedState = current.memoizedState;
7191 workInProgress.updateQueue = current.updateQueue;
7192
7193 // These will be overridden during the parent's reconciliation
7194 workInProgress.sibling = current.sibling;
7195 workInProgress.index = current.index;
7196 workInProgress.ref = current.ref;
7197
7198 return workInProgress;
7199}
7200
7201function createHostRootFiber(isAsync) {
7202 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