(finishedWork, root, lanes)
| 24328 | } |
| 24329 | |
| 24330 | function commitMutationEffectsOnFiber(finishedWork, root, lanes) { |
| 24331 | var current = finishedWork.alternate; |
| 24332 | var flags = finishedWork.flags; // The effect flag should be checked *after* we refine the type of fiber, |
| 24333 | // because the fiber tag is more specific. An exception is any flag related |
| 24334 | // to reconcilation, because those can be set on all fiber types. |
| 24335 | |
| 24336 | switch (finishedWork.tag) { |
| 24337 | case FunctionComponent: |
| 24338 | case ForwardRef: |
| 24339 | case MemoComponent: |
| 24340 | case SimpleMemoComponent: |
| 24341 | { |
| 24342 | recursivelyTraverseMutationEffects(root, finishedWork); |
| 24343 | commitReconciliationEffects(finishedWork); |
| 24344 | |
| 24345 | if (flags & Update) { |
| 24346 | try { |
| 24347 | commitHookEffectListUnmount(Insertion | HasEffect, finishedWork, finishedWork.return); |
| 24348 | commitHookEffectListMount(Insertion | HasEffect, finishedWork); |
| 24349 | } catch (error) { |
| 24350 | captureCommitPhaseError(finishedWork, finishedWork.return, error); |
| 24351 | } // Layout effects are destroyed during the mutation phase so that all |
| 24352 | // destroy functions for all fibers are called before any create functions. |
| 24353 | // This prevents sibling component effects from interfering with each other, |
| 24354 | // e.g. a destroy function in one component should never override a ref set |
| 24355 | // by a create function in another component during the same commit. |
| 24356 | |
| 24357 | |
| 24358 | if ( finishedWork.mode & ProfileMode) { |
| 24359 | try { |
| 24360 | startLayoutEffectTimer(); |
| 24361 | commitHookEffectListUnmount(Layout | HasEffect, finishedWork, finishedWork.return); |
| 24362 | } catch (error) { |
| 24363 | captureCommitPhaseError(finishedWork, finishedWork.return, error); |
| 24364 | } |
| 24365 | |
| 24366 | recordLayoutEffectDuration(finishedWork); |
| 24367 | } else { |
| 24368 | try { |
| 24369 | commitHookEffectListUnmount(Layout | HasEffect, finishedWork, finishedWork.return); |
| 24370 | } catch (error) { |
| 24371 | captureCommitPhaseError(finishedWork, finishedWork.return, error); |
| 24372 | } |
| 24373 | } |
| 24374 | } |
| 24375 | |
| 24376 | return; |
| 24377 | } |
| 24378 | |
| 24379 | case ClassComponent: |
| 24380 | { |
| 24381 | recursivelyTraverseMutationEffects(root, finishedWork); |
| 24382 | commitReconciliationEffects(finishedWork); |
| 24383 | |
| 24384 | if (flags & Ref) { |
| 24385 | if (current !== null) { |
| 24386 | safelyDetachRef(current, current.return); |
| 24387 | } |
no test coverage detected
searching dependent graphs…