(finishedRoot, current, renderPriorityLevel)
| 20184 | |
| 20185 | |
| 20186 | function commitUnmount(finishedRoot, current, renderPriorityLevel) { |
| 20187 | onCommitUnmount(current); |
| 20188 | |
| 20189 | switch (current.tag) { |
| 20190 | case FunctionComponent: |
| 20191 | case ForwardRef: |
| 20192 | case MemoComponent: |
| 20193 | case SimpleMemoComponent: |
| 20194 | case Block: |
| 20195 | { |
| 20196 | var updateQueue = current.updateQueue; |
| 20197 | |
| 20198 | if (updateQueue !== null) { |
| 20199 | var lastEffect = updateQueue.lastEffect; |
| 20200 | |
| 20201 | if (lastEffect !== null) { |
| 20202 | var firstEffect = lastEffect.next; |
| 20203 | |
| 20204 | { |
| 20205 | // When the owner fiber is deleted, the destroy function of a passive |
| 20206 | // effect hook is called during the synchronous commit phase. This is |
| 20207 | // a concession to implementation complexity. Calling it in the |
| 20208 | // passive effect phase (like they usually are, when dependencies |
| 20209 | // change during an update) would require either traversing the |
| 20210 | // children of the deleted fiber again, or including unmount effects |
| 20211 | // as part of the fiber effect list. |
| 20212 | // |
| 20213 | // Because this is during the sync commit phase, we need to change |
| 20214 | // the priority. |
| 20215 | // |
| 20216 | // TODO: Reconsider this implementation trade off. |
| 20217 | var priorityLevel = renderPriorityLevel > NormalPriority ? NormalPriority : renderPriorityLevel; |
| 20218 | runWithPriority$1(priorityLevel, function () { |
| 20219 | var effect = firstEffect; |
| 20220 | |
| 20221 | do { |
| 20222 | var _destroy = effect.destroy; |
| 20223 | |
| 20224 | if (_destroy !== undefined) { |
| 20225 | safelyCallDestroy(current, _destroy); |
| 20226 | } |
| 20227 | |
| 20228 | effect = effect.next; |
| 20229 | } while (effect !== firstEffect); |
| 20230 | }); |
| 20231 | } |
| 20232 | } |
| 20233 | } |
| 20234 | |
| 20235 | return; |
| 20236 | } |
| 20237 | |
| 20238 | case ClassComponent: |
| 20239 | { |
| 20240 | safelyDetachRef(current); |
| 20241 | var instance = current.stateNode; |
| 20242 | |
| 20243 | if (typeof instance.componentWillUnmount === 'function') { |
no test coverage detected