(workInProgress)
| 12392 | } |
| 12393 | |
| 12394 | function completeUnitOfWork(workInProgress) { |
| 12395 | // Attempt to complete the current unit of work, then move to the |
| 12396 | // next sibling. If there are no more siblings, return to the |
| 12397 | // parent fiber. |
| 12398 | while (true) { |
| 12399 | // The current, flushed, state of this fiber is the alternate. |
| 12400 | // Ideally nothing should rely on this, but relying on it here |
| 12401 | // means that we don't need an additional field on the work in |
| 12402 | // progress. |
| 12403 | var current = workInProgress.alternate; |
| 12404 | { |
| 12405 | ReactDebugCurrentFiber.setCurrentFiber(workInProgress); |
| 12406 | } |
| 12407 | |
| 12408 | var returnFiber = workInProgress['return']; |
| 12409 | var siblingFiber = workInProgress.sibling; |
| 12410 | |
| 12411 | if ((workInProgress.effectTag & Incomplete) === NoEffect) { |
| 12412 | // This fiber completed. |
| 12413 | var next = completeWork(current, workInProgress, nextRenderExpirationTime); |
| 12414 | stopWorkTimer(workInProgress); |
| 12415 | resetExpirationTime(workInProgress, nextRenderExpirationTime); |
| 12416 | { |
| 12417 | ReactDebugCurrentFiber.resetCurrentFiber(); |
| 12418 | } |
| 12419 | |
| 12420 | if (next !== null) { |
| 12421 | stopWorkTimer(workInProgress); |
| 12422 | if (true && ReactFiberInstrumentation_1.debugTool) { |
| 12423 | ReactFiberInstrumentation_1.debugTool.onCompleteWork(workInProgress); |
| 12424 | } |
| 12425 | // If completing this work spawned new work, do that next. We'll come |
| 12426 | // back here again. |
| 12427 | return next; |
| 12428 | } |
| 12429 | |
| 12430 | if (returnFiber !== null && |
| 12431 | // Do not append effects to parents if a sibling failed to complete |
| 12432 | (returnFiber.effectTag & Incomplete) === NoEffect) { |
| 12433 | // Append all the effects of the subtree and this fiber onto the effect |
| 12434 | // list of the parent. The completion order of the children affects the |
| 12435 | // side-effect order. |
| 12436 | if (returnFiber.firstEffect === null) { |
| 12437 | returnFiber.firstEffect = workInProgress.firstEffect; |
| 12438 | } |
| 12439 | if (workInProgress.lastEffect !== null) { |
| 12440 | if (returnFiber.lastEffect !== null) { |
| 12441 | returnFiber.lastEffect.nextEffect = workInProgress.firstEffect; |
| 12442 | } |
| 12443 | returnFiber.lastEffect = workInProgress.lastEffect; |
| 12444 | } |
| 12445 | |
| 12446 | // If this fiber had side-effects, we append it AFTER the children's |
| 12447 | // side-effects. We can perform certain side-effects earlier if |
| 12448 | // needed, by doing multiple passes over the effect list. We don't want |
| 12449 | // to schedule our own side-effect on our own list because if end up |
| 12450 | // reusing children we'll schedule this effect onto itself since we're |
| 12451 | // at the end. |
no test coverage detected