Skip to content

Commit

Permalink
change destroy to safelyCallDestroy (#19605)
Browse files Browse the repository at this point in the history
We use safelyCallDestroy for commitUnmount and passive effects unmounts but we call destroy directly in commitHookEffectListUnmount (AKA layout effects unmounts because we don't use this anywhere else). This PR changes the direct destroy call to safelyCallDestroy for consistency
  • Loading branch information
lunaruan authored Aug 18, 2020
1 parent bcca5a6 commit ee409ea
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/react-reconciler/src/ReactFiberCommitWork.new.js
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ function commitHookEffectListUnmount(tag: HookEffectTag, finishedWork: Fiber) {
const destroy = effect.destroy;
effect.destroy = undefined;
if (destroy !== undefined) {
destroy();
safelyCallDestroy(finishedWork, destroy);
}
}
effect = effect.next;
Expand Down

0 comments on commit ee409ea

Please sign in to comment.