MCPcopy Index your code
hub / github.com/microsoft/SandDance / createWorkInProgress

Function createWorkInProgress

docs/external/js/react-dom.development.js:23828–23920  ·  view source on GitHub ↗
(current, pendingProps)

Source from the content-addressed store, hash-verified

23826 } // This is used to create an alternate fiber to do work on.
23827
23828 function createWorkInProgress(current, pendingProps) {
23829 var workInProgress = current.alternate;
23830
23831 if (workInProgress === null) {
23832 // We use a double buffering pooling technique because we know that we'll
23833 // only ever need at most two versions of a tree. We pool the "other" unused
23834 // node that we're free to reuse. This is lazily created to avoid allocating
23835 // extra objects for things that are never updated. It also allow us to
23836 // reclaim the extra memory if needed.
23837 workInProgress = createFiber(current.tag, pendingProps, current.key, current.mode);
23838 workInProgress.elementType = current.elementType;
23839 workInProgress.type = current.type;
23840 workInProgress.stateNode = current.stateNode;
23841
23842 {
23843 // DEV-only fields
23844 {
23845 workInProgress._debugID = current._debugID;
23846 }
23847
23848 workInProgress._debugSource = current._debugSource;
23849 workInProgress._debugOwner = current._debugOwner;
23850 workInProgress._debugHookTypes = current._debugHookTypes;
23851 }
23852
23853 workInProgress.alternate = current;
23854 current.alternate = workInProgress;
23855 } else {
23856 workInProgress.pendingProps = pendingProps; // We already have an alternate.
23857 // Reset the effect tag.
23858
23859 workInProgress.effectTag = NoEffect; // The effect list is no longer valid.
23860
23861 workInProgress.nextEffect = null;
23862 workInProgress.firstEffect = null;
23863 workInProgress.lastEffect = null;
23864
23865 {
23866 // We intentionally reset, rather than copy, actualDuration & actualStartTime.
23867 // This prevents time from endlessly accumulating in new commits.
23868 // This has the downside of resetting values for different priority renders,
23869 // But works for yielding (the common case) and should support resuming.
23870 workInProgress.actualDuration = 0;
23871 workInProgress.actualStartTime = -1;
23872 }
23873 }
23874
23875 workInProgress.childExpirationTime = current.childExpirationTime;
23876 workInProgress.expirationTime = current.expirationTime;
23877 workInProgress.child = current.child;
23878 workInProgress.memoizedProps = current.memoizedProps;
23879 workInProgress.memoizedState = current.memoizedState;
23880 workInProgress.updateQueue = current.updateQueue; // Clone the dependencies object. This is mutated during the render phase, so
23881 // it cannot be shared with the current fiber.
23882
23883 var currentDependencies = current.dependencies;
23884 workInProgress.dependencies = currentDependencies === null ? null : {
23885 expirationTime: currentDependencies.expirationTime,

Callers 5

useFiberFunction · 0.85
cloneChildFibersFunction · 0.85
updateMemoComponentFunction · 0.85
updateSuspenseComponentFunction · 0.85
prepareFreshStackFunction · 0.85

Calls 4

createFiberFunction · 0.85

Tested by

no test coverage detected