@samitouri / QOS-React-2 / commits / 23595ff593

Add missing param to safelyCallDestroy() (#19638)

Brian Vaughn committed Aug 18, 2020 at 12:02 UTC 23595ff593b2e53ddfec2a08e848704d15d84b51
1 file changed +22 -5
packages/react-reconciler/src/ReactFiberCommitWork.new.js
+22 -5
@@ -323,7 +323,11 @@ function commitBeforeMutationLifeCycles(
323 );
324 }
325
326 -function commitHookEffectListUnmount(tag: HookEffectTag, finishedWork: Fiber) {
326 +function commitHookEffectListUnmount(
327 + tag: HookEffectTag,
328 + finishedWork: Fiber,
329 + nearestMountedAncestor: Fiber | null,
330 +) {
331 const updateQueue: FunctionComponentUpdateQueue | null = (finishedWork.updateQueue: any);
332 const lastEffect = updateQueue !== null ? updateQueue.lastEffect : null;
333 if (lastEffect !== null) {
@@ -335,7 +339,7 @@ function commitHookEffectListUnmount(tag: HookEffectTag, finishedWork: Fiber) {
339 const destroy = effect.destroy;
340 effect.destroy = undefined;
341 if (destroy !== undefined) {
338 - safelyCallDestroy(finishedWork, destroy);
342 + safelyCallDestroy(finishedWork, nearestMountedAncestor, destroy);
343 }
344 }
345 effect = effect.next;
@@ -1598,12 +1602,17 @@ function commitWork(current: Fiber | null, finishedWork: Fiber): void {
1602 commitHookEffectListUnmount(
1603 HookLayout | HookHasEffect,
1604 finishedWork,
1605 + finishedWork.return,
1606 );
1607 } finally {
1608 recordLayoutEffectDuration(finishedWork);
1609 }
1610 } else {
1606 - commitHookEffectListUnmount(HookLayout | HookHasEffect, finishedWork);
1611 + commitHookEffectListUnmount(
1612 + HookLayout | HookHasEffect,
1613 + finishedWork,
1614 + finishedWork.return,
1615 + );
1616 }
1617 return;
1618 }
@@ -1658,12 +1667,20 @@ function commitWork(current: Fiber | null, finishedWork: Fiber): void {
1667 ) {
1668 try {
1669 startLayoutEffectTimer();
1661 - commitHookEffectListUnmount(HookLayout | HookHasEffect, finishedWork);
1670 + commitHookEffectListUnmount(
1671 + HookLayout | HookHasEffect,
1672 + finishedWork,
1673 + finishedWork.return,
1674 + );
1675 } finally {
1676 recordLayoutEffectDuration(finishedWork);
1677 }
1678 } else {
1666 - commitHookEffectListUnmount(HookLayout | HookHasEffect, finishedWork);
1679 + commitHookEffectListUnmount(
1680 + HookLayout | HookHasEffect,
1681 + finishedWork,
1682 + finishedWork.return,
1683 + );
1684 }
1685 return;
1686 }