(workInProgress)
| 13206 | } |
| 13207 | |
| 13208 | function completeUnitOfWork(workInProgress) { |
| 13209 | // Attempt to complete the current unit of work, then move to the |
| 13210 | // next sibling. If there are no more siblings, return to the |
| 13211 | // parent fiber. |
| 13212 | while (true) { |
| 13213 | // The current, flushed, state of this fiber is the alternate. |
| 13214 | // Ideally nothing should rely on this, but relying on it here |
| 13215 | // means that we don't need an additional field on the work in |
| 13216 | // progress. |
| 13217 | var current = workInProgress.alternate; |
| 13218 | { |
| 13219 | ReactDebugCurrentFiber.setCurrentFiber(workInProgress); |
| 13220 | } |
| 13221 | |
| 13222 | var returnFiber = workInProgress['return']; |
| 13223 | var siblingFiber = workInProgress.sibling; |
| 13224 | |
| 13225 | if ((workInProgress.effectTag & Incomplete) === NoEffect) { |
| 13226 | // This fiber completed. |
| 13227 | var next = completeWork(current, workInProgress, nextRenderExpirationTime); |
| 13228 | stopWorkTimer(workInProgress); |
| 13229 | resetExpirationTime(workInProgress, nextRenderExpirationTime); |
| 13230 | { |
| 13231 | ReactDebugCurrentFiber.resetCurrentFiber(); |
| 13232 | } |
| 13233 | |
| 13234 | if (next !== null) { |
| 13235 | stopWorkTimer(workInProgress); |
| 13236 | if (true && ReactFiberInstrumentation_1.debugTool) { |
| 13237 | ReactFiberInstrumentation_1.debugTool.onCompleteWork(workInProgress); |
| 13238 | } |
| 13239 | // If completing this work spawned new work, do that next. We'll come |
| 13240 | // back here again. |
| 13241 | return next; |
| 13242 | } |
| 13243 | |
| 13244 | if (returnFiber !== null && |
| 13245 | // Do not append effects to parents if a sibling failed to complete |
| 13246 | (returnFiber.effectTag & Incomplete) === NoEffect) { |
| 13247 | // Append all the effects of the subtree and this fiber onto the effect |
| 13248 | // list of the parent. The completion order of the children affects the |
| 13249 | // side-effect order. |
| 13250 | if (returnFiber.firstEffect === null) { |
| 13251 | returnFiber.firstEffect = workInProgress.firstEffect; |
| 13252 | } |
| 13253 | if (workInProgress.lastEffect !== null) { |
| 13254 | if (returnFiber.lastEffect !== null) { |
| 13255 | returnFiber.lastEffect.nextEffect = workInProgress.firstEffect; |
| 13256 | } |
| 13257 | returnFiber.lastEffect = workInProgress.lastEffect; |
| 13258 | } |
| 13259 | |
| 13260 | // If this fiber had side-effects, we append it AFTER the children's |
| 13261 | // side-effects. We can perform certain side-effects earlier if |
| 13262 | // needed, by doing multiple passes over the effect list. We don't want |
| 13263 | // to schedule our own side-effect on our own list because if end up |
| 13264 | // reusing children we'll schedule this effect onto itself since we're |
| 13265 | // at the end. |
no test coverage detected