(unitOfWork)
| 25865 | } |
| 25866 | |
| 25867 | function completeUnitOfWork(unitOfWork) { |
| 25868 | // Attempt to complete the current unit of work, then move to the next |
| 25869 | // sibling. If there are no more siblings, return to the parent fiber. |
| 25870 | workInProgress = unitOfWork; |
| 25871 | |
| 25872 | do { |
| 25873 | // The current, flushed, state of this fiber is the alternate. Ideally |
| 25874 | // nothing should rely on this, but relying on it here means that we don't |
| 25875 | // need an additional field on the work in progress. |
| 25876 | var current = workInProgress.alternate; |
| 25877 | var returnFiber = workInProgress.return; // Check if the work completed or if something threw. |
| 25878 | |
| 25879 | if ((workInProgress.effectTag & Incomplete) === NoEffect) { |
| 25880 | setCurrentFiber(workInProgress); |
| 25881 | var next = void 0; |
| 25882 | |
| 25883 | if ( (workInProgress.mode & ProfileMode) === NoMode) { |
| 25884 | next = completeWork(current, workInProgress, renderExpirationTime$1); |
| 25885 | } else { |
| 25886 | startProfilerTimer(workInProgress); |
| 25887 | next = completeWork(current, workInProgress, renderExpirationTime$1); // Update render duration assuming we didn't error. |
| 25888 | |
| 25889 | stopProfilerTimerIfRunningAndRecordDelta(workInProgress, false); |
| 25890 | } |
| 25891 | |
| 25892 | stopWorkTimer(workInProgress); |
| 25893 | resetCurrentFiber(); |
| 25894 | resetChildExpirationTime(workInProgress); |
| 25895 | |
| 25896 | if (next !== null) { |
| 25897 | // Completing this fiber spawned new work. Work on that next. |
| 25898 | return next; |
| 25899 | } |
| 25900 | |
| 25901 | if (returnFiber !== null && // Do not append effects to parents if a sibling failed to complete |
| 25902 | (returnFiber.effectTag & Incomplete) === NoEffect) { |
| 25903 | // Append all the effects of the subtree and this fiber onto the effect |
| 25904 | // list of the parent. The completion order of the children affects the |
| 25905 | // side-effect order. |
| 25906 | if (returnFiber.firstEffect === null) { |
| 25907 | returnFiber.firstEffect = workInProgress.firstEffect; |
| 25908 | } |
| 25909 | |
| 25910 | if (workInProgress.lastEffect !== null) { |
| 25911 | if (returnFiber.lastEffect !== null) { |
| 25912 | returnFiber.lastEffect.nextEffect = workInProgress.firstEffect; |
| 25913 | } |
| 25914 | |
| 25915 | returnFiber.lastEffect = workInProgress.lastEffect; |
| 25916 | } // If this fiber had side-effects, we append it AFTER the children's |
| 25917 | // side-effects. We can perform certain side-effects earlier if needed, |
| 25918 | // by doing multiple passes over the effect list. We don't want to |
| 25919 | // schedule our own side-effect on our own list because if end up |
| 25920 | // reusing children we'll schedule this effect onto itself since we're |
| 25921 | // at the end. |
| 25922 | |
| 25923 | |
| 25924 | var effectTag = workInProgress.effectTag; // Skip both NoWork and PerformedWork tags when creating the effect |
no test coverage detected