Teact: Check for mountState in cleanup (#5214)
This commit is contained in:
parent
46c0dcb945
commit
ecbc32d0fd
@ -749,6 +749,10 @@ function scheduleEffect(
|
|||||||
|
|
||||||
if (cleanup) {
|
if (cleanup) {
|
||||||
const runEffectCleanup = () => safeExec(() => {
|
const runEffectCleanup = () => safeExec(() => {
|
||||||
|
if (componentInstance.mountState === MountState.Unmounted) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||||
let DEBUG_startAt: number | undefined;
|
let DEBUG_startAt: number | undefined;
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
@ -767,8 +771,6 @@ function scheduleEffect(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return undefined;
|
|
||||||
}, () => {
|
}, () => {
|
||||||
// eslint-disable-next-line no-console, max-len
|
// eslint-disable-next-line no-console, max-len
|
||||||
console.error(`[Teact] Error in effect cleanup at cursor #${cursor} in ${componentInstance.name}`, componentInstance);
|
console.error(`[Teact] Error in effect cleanup at cursor #${cursor} in ${componentInstance.name}`, componentInstance);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user