(workInProgress)
| 12301 | } |
| 12302 | |
| 12303 | function completeUnitOfWork(workInProgress) { |
| 12304 | // Attempt to complete the current unit of work, then move to the |
| 12305 | // next sibling. If there are no more siblings, return to the |
| 12306 | // parent fiber. |
| 12307 | while (true) { |
| 12308 | // The current, flushed, state of this fiber is the alternate. |
| 12309 | // Ideally nothing should rely on this, but relying on it here |
| 12310 | // means that we don't need an additional field on the work in |
| 12311 | // progress. |
| 12312 | var current = workInProgress.alternate; |
| 12313 | { |
| 12314 | ReactDebugCurrentFiber.setCurrentFiber(workInProgress); |
| 12315 | } |
| 12316 | |
| 12317 | var returnFiber = workInProgress['return']; |
| 12318 | var siblingFiber = workInProgress.sibling; |
| 12319 | |
| 12320 | if ((workInProgress.effectTag & Incomplete) === NoEffect) { |
| 12321 | // This fiber completed. |
| 12322 | var next = completeWork(current, workInProgress, nextRenderExpirationTime); |
| 12323 | stopWorkTimer(workInProgress); |
| 12324 | resetExpirationTime(workInProgress, nextRenderExpirationTime); |
| 12325 | { |
| 12326 | ReactDebugCurrentFiber.resetCurrentFiber(); |
| 12327 | } |
| 12328 | |
| 12329 | if (next !== null) { |
| 12330 | stopWorkTimer(workInProgress); |
| 12331 | if (true && ReactFiberInstrumentation_1.debugTool) { |
| 12332 | ReactFiberInstrumentation_1.debugTool.onCompleteWork(workInProgress); |
| 12333 | } |
| 12334 | // If completing this work spawned new work, do that next. We'll come |
| 12335 | // back here again. |
| 12336 | return next; |
| 12337 | } |
| 12338 | |
| 12339 | if (returnFiber !== null && |
| 12340 | // Do not append effects to parents if a sibling failed to complete |
| 12341 | (returnFiber.effectTag & Incomplete) === NoEffect) { |
| 12342 | // Append all the effects of the subtree and this fiber onto the effect |
| 12343 | // list of the parent. The completion order of the children affects the |
| 12344 | // side-effect order. |
| 12345 | if (returnFiber.firstEffect === null) { |
| 12346 | returnFiber.firstEffect = workInProgress.firstEffect; |
| 12347 | } |
| 12348 | if (workInProgress.lastEffect !== null) { |
| 12349 | if (returnFiber.lastEffect !== null) { |
| 12350 | returnFiber.lastEffect.nextEffect = workInProgress.firstEffect; |
| 12351 | } |
| 12352 | returnFiber.lastEffect = workInProgress.lastEffect; |
| 12353 | } |
| 12354 | |
| 12355 | // If this fiber had side-effects, we append it AFTER the children's |
| 12356 | // side-effects. We can perform certain side-effects earlier if |
| 12357 | // needed, by doing multiple passes over the effect list. We don't want |
| 12358 | // to schedule our own side-effect on our own list because if end up |
| 12359 | // reusing children we'll schedule this effect onto itself since we're |
| 12360 | // at the end. |
no test coverage detected