(finishedRoot, current, renderPriorityLevel)
| 23744 | |
| 23745 | |
| 23746 | function commitUnmount(finishedRoot, current, renderPriorityLevel) { |
| 23747 | onCommitUnmount(current); |
| 23748 | |
| 23749 | switch (current.tag) { |
| 23750 | case FunctionComponent: |
| 23751 | case ForwardRef: |
| 23752 | case MemoComponent: |
| 23753 | case SimpleMemoComponent: |
| 23754 | case Block: |
| 23755 | { |
| 23756 | var updateQueue = current.updateQueue; |
| 23757 | |
| 23758 | if (updateQueue !== null) { |
| 23759 | var lastEffect = updateQueue.lastEffect; |
| 23760 | |
| 23761 | if (lastEffect !== null) { |
| 23762 | var firstEffect = lastEffect.next; |
| 23763 | |
| 23764 | { |
| 23765 | // When the owner fiber is deleted, the destroy function of a passive |
| 23766 | // effect hook is called during the synchronous commit phase. This is |
| 23767 | // a concession to implementation complexity. Calling it in the |
| 23768 | // passive effect phase (like they usually are, when dependencies |
| 23769 | // change during an update) would require either traversing the |
| 23770 | // children of the deleted fiber again, or including unmount effects |
| 23771 | // as part of the fiber effect list. |
| 23772 | // |
| 23773 | // Because this is during the sync commit phase, we need to change |
| 23774 | // the priority. |
| 23775 | // |
| 23776 | // TODO: Reconsider this implementation trade off. |
| 23777 | var priorityLevel = renderPriorityLevel > NormalPriority ? NormalPriority : renderPriorityLevel; |
| 23778 | runWithPriority$1(priorityLevel, function () { |
| 23779 | var effect = firstEffect; |
| 23780 | |
| 23781 | do { |
| 23782 | var _destroy = effect.destroy; |
| 23783 | |
| 23784 | if (_destroy !== undefined) { |
| 23785 | safelyCallDestroy(current, _destroy); |
| 23786 | } |
| 23787 | |
| 23788 | effect = effect.next; |
| 23789 | } while (effect !== firstEffect); |
| 23790 | }); |
| 23791 | } |
| 23792 | } |
| 23793 | } |
| 23794 | |
| 23795 | return; |
| 23796 | } |
| 23797 | |
| 23798 | case ClassComponent: |
| 23799 | { |
| 23800 | safelyDetachRef(current); |
| 23801 | var instance = current.stateNode; |
| 23802 | |
| 23803 | if (typeof instance.componentWillUnmount === 'function') { |
no test coverage detected