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

Function createWorkInProgress

code/communication/public/app.js:6936–6983  ·  view source on GitHub ↗
(current, pendingProps, expirationTime)

Source from the content-addressed store, hash-verified

6934
6935// This is used to create an alternate fiber to do work on.
6936function createWorkInProgress(current, pendingProps, expirationTime) {
6937 var workInProgress = current.alternate;
6938 if (workInProgress === null) {
6939 // We use a double buffering pooling technique because we know that we'll
6940 // only ever need at most two versions of a tree. We pool the "other" unused
6941 // node that we're free to reuse. This is lazily created to avoid allocating
6942 // extra objects for things that are never updated. It also allow us to
6943 // reclaim the extra memory if needed.
6944 workInProgress = createFiber(current.tag, pendingProps, current.key, current.mode);
6945 workInProgress.type = current.type;
6946 workInProgress.stateNode = current.stateNode;
6947
6948 {
6949 // DEV-only fields
6950 workInProgress._debugID = current._debugID;
6951 workInProgress._debugSource = current._debugSource;
6952 workInProgress._debugOwner = current._debugOwner;
6953 }
6954
6955 workInProgress.alternate = current;
6956 current.alternate = workInProgress;
6957 } else {
6958 workInProgress.pendingProps = pendingProps;
6959
6960 // We already have an alternate.
6961 // Reset the effect tag.
6962 workInProgress.effectTag = NoEffect;
6963
6964 // The effect list is no longer valid.
6965 workInProgress.nextEffect = null;
6966 workInProgress.firstEffect = null;
6967 workInProgress.lastEffect = null;
6968 }
6969
6970 workInProgress.expirationTime = expirationTime;
6971
6972 workInProgress.child = current.child;
6973 workInProgress.memoizedProps = current.memoizedProps;
6974 workInProgress.memoizedState = current.memoizedState;
6975 workInProgress.updateQueue = current.updateQueue;
6976
6977 // These will be overridden during the parent's reconciliation
6978 workInProgress.sibling = current.sibling;
6979 workInProgress.index = current.index;
6980 workInProgress.ref = current.ref;
6981
6982 return workInProgress;
6983}
6984
6985function createHostRootFiber(isAsync) {
6986 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