Skip to content

Commit 377a9da

Browse files
lunaruankoto
authored andcommitted
change destroy to safelyCallDestroy (facebook#19605)
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
1 parent 5459507 commit 377a9da

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/react-reconciler/src/ReactFiberCommitWork.new.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ function commitHookEffectListUnmount(tag: HookEffectTag, finishedWork: Fiber) {
335335
const destroy = effect.destroy;
336336
effect.destroy = undefined;
337337
if (destroy !== undefined) {
338-
destroy();
338+
safelyCallDestroy(finishedWork, destroy);
339339
}
340340
}
341341
effect = effect.next;

0 commit comments

Comments
 (0)