(unitOfWork)
| 22305 | } |
| 22306 | |
| 22307 | function completeUnitOfWork(unitOfWork) { |
| 22308 | // Attempt to complete the current unit of work, then move to the next |
| 22309 | // sibling. If there are no more siblings, return to the parent fiber. |
| 22310 | workInProgress = unitOfWork; |
| 22311 | |
| 22312 | do { |
| 22313 | // The current, flushed, state of this fiber is the alternate. Ideally |
| 22314 | // nothing should rely on this, but relying on it here means that we don't |
| 22315 | // need an additional field on the work in progress. |
| 22316 | var current = workInProgress.alternate; |
| 22317 | var returnFiber = workInProgress.return; // Check if the work completed or if something threw. |
| 22318 | |
| 22319 | if ((workInProgress.effectTag & Incomplete) === NoEffect) { |
| 22320 | setCurrentFiber(workInProgress); |
| 22321 | var next = void 0; |
| 22322 | |
| 22323 | if ( (workInProgress.mode & ProfileMode) === NoMode) { |
| 22324 | next = completeWork(current, workInProgress, renderExpirationTime$1); |
| 22325 | } else { |
| 22326 | startProfilerTimer(workInProgress); |
| 22327 | next = completeWork(current, workInProgress, renderExpirationTime$1); // Update render duration assuming we didn't error. |
| 22328 | |
| 22329 | stopProfilerTimerIfRunningAndRecordDelta(workInProgress, false); |
| 22330 | } |
| 22331 | |
| 22332 | stopWorkTimer(workInProgress); |
| 22333 | resetCurrentFiber(); |
| 22334 | resetChildExpirationTime(workInProgress); |
| 22335 | |
| 22336 | if (next !== null) { |
| 22337 | // Completing this fiber spawned new work. Work on that next. |
| 22338 | return next; |
| 22339 | } |
| 22340 | |
| 22341 | if (returnFiber !== null && // Do not append effects to parents if a sibling failed to complete |
| 22342 | (returnFiber.effectTag & Incomplete) === NoEffect) { |
| 22343 | // Append all the effects of the subtree and this fiber onto the effect |
| 22344 | // list of the parent. The completion order of the children affects the |
| 22345 | // side-effect order. |
| 22346 | if (returnFiber.firstEffect === null) { |
| 22347 | returnFiber.firstEffect = workInProgress.firstEffect; |
| 22348 | } |
| 22349 | |
| 22350 | if (workInProgress.lastEffect !== null) { |
| 22351 | if (returnFiber.lastEffect !== null) { |
| 22352 | returnFiber.lastEffect.nextEffect = workInProgress.firstEffect; |
| 22353 | } |
| 22354 | |
| 22355 | returnFiber.lastEffect = workInProgress.lastEffect; |
| 22356 | } // If this fiber had side-effects, we append it AFTER the children's |
| 22357 | // side-effects. We can perform certain side-effects earlier if needed, |
| 22358 | // by doing multiple passes over the effect list. We don't want to |
| 22359 | // schedule our own side-effect on our own list because if end up |
| 22360 | // reusing children we'll schedule this effect onto itself since we're |
| 22361 | // at the end. |
| 22362 | |
| 22363 | |
| 22364 | var effectTag = workInProgress.effectTag; // Skip both NoWork and PerformedWork tags when creating the effect |
no test coverage detected