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

Function createWorkInProgress

code/third-party/public/app.js:6134–6181  ·  view source on GitHub ↗
(current, pendingProps, expirationTime)

Source from the content-addressed store, hash-verified

6132
6133// This is used to create an alternate fiber to do work on.
6134function createWorkInProgress(current, pendingProps, expirationTime) {
6135 var workInProgress = current.alternate;
6136 if (workInProgress === null) {
6137 // We use a double buffering pooling technique because we know that we'll
6138 // only ever need at most two versions of a tree. We pool the "other" unused
6139 // node that we're free to reuse. This is lazily created to avoid allocating
6140 // extra objects for things that are never updated. It also allow us to
6141 // reclaim the extra memory if needed.
6142 workInProgress = createFiber(current.tag, pendingProps, current.key, current.mode);
6143 workInProgress.type = current.type;
6144 workInProgress.stateNode = current.stateNode;
6145
6146 {
6147 // DEV-only fields
6148 workInProgress._debugID = current._debugID;
6149 workInProgress._debugSource = current._debugSource;
6150 workInProgress._debugOwner = current._debugOwner;
6151 }
6152
6153 workInProgress.alternate = current;
6154 current.alternate = workInProgress;
6155 } else {
6156 workInProgress.pendingProps = pendingProps;
6157
6158 // We already have an alternate.
6159 // Reset the effect tag.
6160 workInProgress.effectTag = NoEffect;
6161
6162 // The effect list is no longer valid.
6163 workInProgress.nextEffect = null;
6164 workInProgress.firstEffect = null;
6165 workInProgress.lastEffect = null;
6166 }
6167
6168 workInProgress.expirationTime = expirationTime;
6169
6170 workInProgress.child = current.child;
6171 workInProgress.memoizedProps = current.memoizedProps;
6172 workInProgress.memoizedState = current.memoizedState;
6173 workInProgress.updateQueue = current.updateQueue;
6174
6175 // These will be overridden during the parent's reconciliation
6176 workInProgress.sibling = current.sibling;
6177 workInProgress.index = current.index;
6178 workInProgress.ref = current.ref;
6179
6180 return workInProgress;
6181}
6182
6183function createHostRootFiber(isAsync) {
6184 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