(workInProgress)
| 13161 | } |
| 13162 | |
| 13163 | function completeUnitOfWork(workInProgress) { |
| 13164 | // Attempt to complete the current unit of work, then move to the |
| 13165 | // next sibling. If there are no more siblings, return to the |
| 13166 | // parent fiber. |
| 13167 | while (true) { |
| 13168 | // The current, flushed, state of this fiber is the alternate. |
| 13169 | // Ideally nothing should rely on this, but relying on it here |
| 13170 | // means that we don't need an additional field on the work in |
| 13171 | // progress. |
| 13172 | var current = workInProgress.alternate; |
| 13173 | { |
| 13174 | ReactDebugCurrentFiber.setCurrentFiber(workInProgress); |
| 13175 | } |
| 13176 | |
| 13177 | var returnFiber = workInProgress['return']; |
| 13178 | var siblingFiber = workInProgress.sibling; |
| 13179 | |
| 13180 | if ((workInProgress.effectTag & Incomplete) === NoEffect) { |
| 13181 | // This fiber completed. |
| 13182 | var next = completeWork(current, workInProgress, nextRenderExpirationTime); |
| 13183 | stopWorkTimer(workInProgress); |
| 13184 | resetExpirationTime(workInProgress, nextRenderExpirationTime); |
| 13185 | { |
| 13186 | ReactDebugCurrentFiber.resetCurrentFiber(); |
| 13187 | } |
| 13188 | |
| 13189 | if (next !== null) { |
| 13190 | stopWorkTimer(workInProgress); |
| 13191 | if (true && ReactFiberInstrumentation_1.debugTool) { |
| 13192 | ReactFiberInstrumentation_1.debugTool.onCompleteWork(workInProgress); |
| 13193 | } |
| 13194 | // If completing this work spawned new work, do that next. We'll come |
| 13195 | // back here again. |
| 13196 | return next; |
| 13197 | } |
| 13198 | |
| 13199 | if (returnFiber !== null && |
| 13200 | // Do not append effects to parents if a sibling failed to complete |
| 13201 | (returnFiber.effectTag & Incomplete) === NoEffect) { |
| 13202 | // Append all the effects of the subtree and this fiber onto the effect |
| 13203 | // list of the parent. The completion order of the children affects the |
| 13204 | // side-effect order. |
| 13205 | if (returnFiber.firstEffect === null) { |
| 13206 | returnFiber.firstEffect = workInProgress.firstEffect; |
| 13207 | } |
| 13208 | if (workInProgress.lastEffect !== null) { |
| 13209 | if (returnFiber.lastEffect !== null) { |
| 13210 | returnFiber.lastEffect.nextEffect = workInProgress.firstEffect; |
| 13211 | } |
| 13212 | returnFiber.lastEffect = workInProgress.lastEffect; |
| 13213 | } |
| 13214 | |
| 13215 | // If this fiber had side-effects, we append it AFTER the children's |
| 13216 | // side-effects. We can perform certain side-effects earlier if |
| 13217 | // needed, by doing multiple passes over the effect list. We don't want |
| 13218 | // to schedule our own side-effect on our own list because if end up |
| 13219 | // reusing children we'll schedule this effect onto itself since we're |
| 13220 | // at the end. |
no test coverage detected