(workInProgress)
| 13319 | } |
| 13320 | |
| 13321 | function completeUnitOfWork(workInProgress) { |
| 13322 | // Attempt to complete the current unit of work, then move to the |
| 13323 | // next sibling. If there are no more siblings, return to the |
| 13324 | // parent fiber. |
| 13325 | while (true) { |
| 13326 | // The current, flushed, state of this fiber is the alternate. |
| 13327 | // Ideally nothing should rely on this, but relying on it here |
| 13328 | // means that we don't need an additional field on the work in |
| 13329 | // progress. |
| 13330 | var current = workInProgress.alternate; |
| 13331 | { |
| 13332 | ReactDebugCurrentFiber.setCurrentFiber(workInProgress); |
| 13333 | } |
| 13334 | |
| 13335 | var returnFiber = workInProgress['return']; |
| 13336 | var siblingFiber = workInProgress.sibling; |
| 13337 | |
| 13338 | if ((workInProgress.effectTag & Incomplete) === NoEffect) { |
| 13339 | // This fiber completed. |
| 13340 | var next = completeWork(current, workInProgress, nextRenderExpirationTime); |
| 13341 | stopWorkTimer(workInProgress); |
| 13342 | resetExpirationTime(workInProgress, nextRenderExpirationTime); |
| 13343 | { |
| 13344 | ReactDebugCurrentFiber.resetCurrentFiber(); |
| 13345 | } |
| 13346 | |
| 13347 | if (next !== null) { |
| 13348 | stopWorkTimer(workInProgress); |
| 13349 | if (true && ReactFiberInstrumentation_1.debugTool) { |
| 13350 | ReactFiberInstrumentation_1.debugTool.onCompleteWork(workInProgress); |
| 13351 | } |
| 13352 | // If completing this work spawned new work, do that next. We'll come |
| 13353 | // back here again. |
| 13354 | return next; |
| 13355 | } |
| 13356 | |
| 13357 | if (returnFiber !== null && |
| 13358 | // Do not append effects to parents if a sibling failed to complete |
| 13359 | (returnFiber.effectTag & Incomplete) === NoEffect) { |
| 13360 | // Append all the effects of the subtree and this fiber onto the effect |
| 13361 | // list of the parent. The completion order of the children affects the |
| 13362 | // side-effect order. |
| 13363 | if (returnFiber.firstEffect === null) { |
| 13364 | returnFiber.firstEffect = workInProgress.firstEffect; |
| 13365 | } |
| 13366 | if (workInProgress.lastEffect !== null) { |
| 13367 | if (returnFiber.lastEffect !== null) { |
| 13368 | returnFiber.lastEffect.nextEffect = workInProgress.firstEffect; |
| 13369 | } |
| 13370 | returnFiber.lastEffect = workInProgress.lastEffect; |
| 13371 | } |
| 13372 | |
| 13373 | // If this fiber had side-effects, we append it AFTER the children's |
| 13374 | // side-effects. We can perform certain side-effects earlier if |
| 13375 | // needed, by doing multiple passes over the effect list. We don't want |
| 13376 | // to schedule our own side-effect on our own list because if end up |
| 13377 | // reusing children we'll schedule this effect onto itself since we're |
| 13378 | // at the end. |
no test coverage detected