(workInProgress)
| 12941 | } |
| 12942 | |
| 12943 | function completeUnitOfWork(workInProgress) { |
| 12944 | // Attempt to complete the current unit of work, then move to the |
| 12945 | // next sibling. If there are no more siblings, return to the |
| 12946 | // parent fiber. |
| 12947 | while (true) { |
| 12948 | // The current, flushed, state of this fiber is the alternate. |
| 12949 | // Ideally nothing should rely on this, but relying on it here |
| 12950 | // means that we don't need an additional field on the work in |
| 12951 | // progress. |
| 12952 | var current = workInProgress.alternate; |
| 12953 | { |
| 12954 | ReactDebugCurrentFiber.setCurrentFiber(workInProgress); |
| 12955 | } |
| 12956 | |
| 12957 | var returnFiber = workInProgress['return']; |
| 12958 | var siblingFiber = workInProgress.sibling; |
| 12959 | |
| 12960 | if ((workInProgress.effectTag & Incomplete) === NoEffect) { |
| 12961 | // This fiber completed. |
| 12962 | var next = completeWork(current, workInProgress, nextRenderExpirationTime); |
| 12963 | stopWorkTimer(workInProgress); |
| 12964 | resetExpirationTime(workInProgress, nextRenderExpirationTime); |
| 12965 | { |
| 12966 | ReactDebugCurrentFiber.resetCurrentFiber(); |
| 12967 | } |
| 12968 | |
| 12969 | if (next !== null) { |
| 12970 | stopWorkTimer(workInProgress); |
| 12971 | if (true && ReactFiberInstrumentation_1.debugTool) { |
| 12972 | ReactFiberInstrumentation_1.debugTool.onCompleteWork(workInProgress); |
| 12973 | } |
| 12974 | // If completing this work spawned new work, do that next. We'll come |
| 12975 | // back here again. |
| 12976 | return next; |
| 12977 | } |
| 12978 | |
| 12979 | if (returnFiber !== null && |
| 12980 | // Do not append effects to parents if a sibling failed to complete |
| 12981 | (returnFiber.effectTag & Incomplete) === NoEffect) { |
| 12982 | // Append all the effects of the subtree and this fiber onto the effect |
| 12983 | // list of the parent. The completion order of the children affects the |
| 12984 | // side-effect order. |
| 12985 | if (returnFiber.firstEffect === null) { |
| 12986 | returnFiber.firstEffect = workInProgress.firstEffect; |
| 12987 | } |
| 12988 | if (workInProgress.lastEffect !== null) { |
| 12989 | if (returnFiber.lastEffect !== null) { |
| 12990 | returnFiber.lastEffect.nextEffect = workInProgress.firstEffect; |
| 12991 | } |
| 12992 | returnFiber.lastEffect = workInProgress.lastEffect; |
| 12993 | } |
| 12994 | |
| 12995 | // If this fiber had side-effects, we append it AFTER the children's |
| 12996 | // side-effects. We can perform certain side-effects earlier if |
| 12997 | // needed, by doing multiple passes over the effect list. We don't want |
| 12998 | // to schedule our own side-effect on our own list because if end up |
| 12999 | // reusing children we'll schedule this effect onto itself since we're |
| 13000 | // at the end. |
no test coverage detected