(finishedWork, root, lanes)
| 24289 | } |
| 24290 | |
| 24291 | function commitMutationEffectsOnFiber(finishedWork, root, lanes) { |
| 24292 | var current = finishedWork.alternate; |
| 24293 | var flags = finishedWork.flags; // The effect flag should be checked *after* we refine the type of fiber, |
| 24294 | // because the fiber tag is more specific. An exception is any flag related |
| 24295 | // to reconcilation, because those can be set on all fiber types. |
| 24296 | |
| 24297 | switch (finishedWork.tag) { |
| 24298 | case FunctionComponent: |
| 24299 | case ForwardRef: |
| 24300 | case MemoComponent: |
| 24301 | case SimpleMemoComponent: |
| 24302 | { |
| 24303 | recursivelyTraverseMutationEffects(root, finishedWork); |
| 24304 | commitReconciliationEffects(finishedWork); |
| 24305 | |
| 24306 | if (flags & Update) { |
| 24307 | try { |
| 24308 | commitHookEffectListUnmount(Insertion | HasEffect, finishedWork, finishedWork.return); |
| 24309 | commitHookEffectListMount(Insertion | HasEffect, finishedWork); |
| 24310 | } catch (error) { |
| 24311 | captureCommitPhaseError(finishedWork, finishedWork.return, error); |
| 24312 | } // Layout effects are destroyed during the mutation phase so that all |
| 24313 | // destroy functions for all fibers are called before any create functions. |
| 24314 | // This prevents sibling component effects from interfering with each other, |
| 24315 | // e.g. a destroy function in one component should never override a ref set |
| 24316 | // by a create function in another component during the same commit. |
| 24317 | |
| 24318 | |
| 24319 | if ( finishedWork.mode & ProfileMode) { |
| 24320 | try { |
| 24321 | startLayoutEffectTimer(); |
| 24322 | commitHookEffectListUnmount(Layout | HasEffect, finishedWork, finishedWork.return); |
| 24323 | } catch (error) { |
| 24324 | captureCommitPhaseError(finishedWork, finishedWork.return, error); |
| 24325 | } |
| 24326 | |
| 24327 | recordLayoutEffectDuration(finishedWork); |
| 24328 | } else { |
| 24329 | try { |
| 24330 | commitHookEffectListUnmount(Layout | HasEffect, finishedWork, finishedWork.return); |
| 24331 | } catch (error) { |
| 24332 | captureCommitPhaseError(finishedWork, finishedWork.return, error); |
| 24333 | } |
| 24334 | } |
| 24335 | } |
| 24336 | |
| 24337 | return; |
| 24338 | } |
| 24339 | |
| 24340 | case ClassComponent: |
| 24341 | { |
| 24342 | recursivelyTraverseMutationEffects(root, finishedWork); |
| 24343 | commitReconciliationEffects(finishedWork); |
| 24344 | |
| 24345 | if (flags & Ref) { |
| 24346 | if (current !== null) { |
| 24347 | safelyDetachRef(current, current.return); |
| 24348 | } |
no test coverage detected
searching dependent graphs…