MCPcopy Create free account
hub / github.com/plotly/dash / createWorkInProgress

Function createWorkInProgress

dash/deps/react-dom@18.3.1.js:28193–28284  ·  view source on GitHub ↗
(current, pendingProps)

Source from the content-addressed store, hash-verified

28191 } // This is used to create an alternate fiber to do work on.
28192
28193 function createWorkInProgress(current, pendingProps) {
28194 var workInProgress = current.alternate;
28195
28196 if (workInProgress === null) {
28197 // We use a double buffering pooling technique because we know that we'll
28198 // only ever need at most two versions of a tree. We pool the "other" unused
28199 // node that we're free to reuse. This is lazily created to avoid allocating
28200 // extra objects for things that are never updated. It also allow us to
28201 // reclaim the extra memory if needed.
28202 workInProgress = createFiber(current.tag, pendingProps, current.key, current.mode);
28203 workInProgress.elementType = current.elementType;
28204 workInProgress.type = current.type;
28205 workInProgress.stateNode = current.stateNode;
28206
28207 {
28208 // DEV-only fields
28209 workInProgress._debugSource = current._debugSource;
28210 workInProgress._debugOwner = current._debugOwner;
28211 workInProgress._debugHookTypes = current._debugHookTypes;
28212 }
28213
28214 workInProgress.alternate = current;
28215 current.alternate = workInProgress;
28216 } else {
28217 workInProgress.pendingProps = pendingProps; // Needed because Blocks store data on type.
28218
28219 workInProgress.type = current.type; // We already have an alternate.
28220 // Reset the effect tag.
28221
28222 workInProgress.flags = NoFlags; // The effects are no longer valid.
28223
28224 workInProgress.subtreeFlags = NoFlags;
28225 workInProgress.deletions = null;
28226
28227 {
28228 // We intentionally reset, rather than copy, actualDuration & actualStartTime.
28229 // This prevents time from endlessly accumulating in new commits.
28230 // This has the downside of resetting values for different priority renders,
28231 // But works for yielding (the common case) and should support resuming.
28232 workInProgress.actualDuration = 0;
28233 workInProgress.actualStartTime = -1;
28234 }
28235 } // Reset all effects except static ones.
28236 // Static effects are not specific to a render.
28237
28238
28239 workInProgress.flags = current.flags & StaticMask;
28240 workInProgress.childLanes = current.childLanes;
28241 workInProgress.lanes = current.lanes;
28242 workInProgress.child = current.child;
28243 workInProgress.memoizedProps = current.memoizedProps;
28244 workInProgress.memoizedState = current.memoizedState;
28245 workInProgress.updateQueue = current.updateQueue; // Clone the dependencies object. This is mutated during the render phase, so
28246 // it cannot be shared with the current fiber.
28247
28248 var currentDependencies = current.dependencies;
28249 workInProgress.dependencies = currentDependencies === null ? null : {
28250 lanes: currentDependencies.lanes,

Callers 6

useFiberFunction · 0.70
cloneChildFibersFunction · 0.70
updateMemoComponentFunction · 0.70
prepareFreshStackFunction · 0.70

Calls 4

createFiberFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…