mirror of
https://github.com/zebrajr/react.git
synced 2025-12-07 00:20:28 +01:00
Add missing param to safelyCallDestroy() (#19638)
This commit is contained in:
parent
24f1923b1b
commit
23595ff593
|
|
@ -323,7 +323,11 @@ function commitBeforeMutationLifeCycles(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function commitHookEffectListUnmount(tag: HookEffectTag, finishedWork: Fiber) {
|
function commitHookEffectListUnmount(
|
||||||
|
tag: HookEffectTag,
|
||||||
|
finishedWork: Fiber,
|
||||||
|
nearestMountedAncestor: Fiber | null,
|
||||||
|
) {
|
||||||
const updateQueue: FunctionComponentUpdateQueue | null = (finishedWork.updateQueue: any);
|
const updateQueue: FunctionComponentUpdateQueue | null = (finishedWork.updateQueue: any);
|
||||||
const lastEffect = updateQueue !== null ? updateQueue.lastEffect : null;
|
const lastEffect = updateQueue !== null ? updateQueue.lastEffect : null;
|
||||||
if (lastEffect !== null) {
|
if (lastEffect !== null) {
|
||||||
|
|
@ -335,7 +339,7 @@ function commitHookEffectListUnmount(tag: HookEffectTag, finishedWork: Fiber) {
|
||||||
const destroy = effect.destroy;
|
const destroy = effect.destroy;
|
||||||
effect.destroy = undefined;
|
effect.destroy = undefined;
|
||||||
if (destroy !== undefined) {
|
if (destroy !== undefined) {
|
||||||
safelyCallDestroy(finishedWork, destroy);
|
safelyCallDestroy(finishedWork, nearestMountedAncestor, destroy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
effect = effect.next;
|
effect = effect.next;
|
||||||
|
|
@ -1598,12 +1602,17 @@ function commitWork(current: Fiber | null, finishedWork: Fiber): void {
|
||||||
commitHookEffectListUnmount(
|
commitHookEffectListUnmount(
|
||||||
HookLayout | HookHasEffect,
|
HookLayout | HookHasEffect,
|
||||||
finishedWork,
|
finishedWork,
|
||||||
|
finishedWork.return,
|
||||||
);
|
);
|
||||||
} finally {
|
} finally {
|
||||||
recordLayoutEffectDuration(finishedWork);
|
recordLayoutEffectDuration(finishedWork);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
commitHookEffectListUnmount(HookLayout | HookHasEffect, finishedWork);
|
commitHookEffectListUnmount(
|
||||||
|
HookLayout | HookHasEffect,
|
||||||
|
finishedWork,
|
||||||
|
finishedWork.return,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -1658,12 +1667,20 @@ function commitWork(current: Fiber | null, finishedWork: Fiber): void {
|
||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
startLayoutEffectTimer();
|
startLayoutEffectTimer();
|
||||||
commitHookEffectListUnmount(HookLayout | HookHasEffect, finishedWork);
|
commitHookEffectListUnmount(
|
||||||
|
HookLayout | HookHasEffect,
|
||||||
|
finishedWork,
|
||||||
|
finishedWork.return,
|
||||||
|
);
|
||||||
} finally {
|
} finally {
|
||||||
recordLayoutEffectDuration(finishedWork);
|
recordLayoutEffectDuration(finishedWork);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
commitHookEffectListUnmount(HookLayout | HookHasEffect, finishedWork);
|
commitHookEffectListUnmount(
|
||||||
|
HookLayout | HookHasEffect,
|
||||||
|
finishedWork,
|
||||||
|
finishedWork.return,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user