Teact: Avoid multiple effects in a single frame (follow-up)
This commit is contained in:
parent
6b235729f4
commit
077dce9fc0
@ -461,10 +461,9 @@ export function unmountComponent(componentInstance: ComponentInstance) {
|
|||||||
effect.cleanup?.();
|
effect.cleanup?.();
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
handleError(err);
|
handleError(err);
|
||||||
} finally {
|
|
||||||
effect.cleanup = undefined;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
effect.cleanup = undefined;
|
||||||
effect.releaseSignals?.();
|
effect.releaseSignals?.();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -586,10 +585,6 @@ function useEffectBase(
|
|||||||
const componentInstance = renderingInstance;
|
const componentInstance = renderingInstance;
|
||||||
|
|
||||||
function execCleanup() {
|
function execCleanup() {
|
||||||
if (!componentInstance.isMounted) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const { cleanup } = byCursor[cursor];
|
const { cleanup } = byCursor[cursor];
|
||||||
if (!cleanup) {
|
if (!cleanup) {
|
||||||
return;
|
return;
|
||||||
@ -618,9 +613,9 @@ function useEffectBase(
|
|||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
console.error(`[Teact] Error in effect cleanup at cursor #${cursor} in ${componentInstance.name}`);
|
console.error(`[Teact] Error in effect cleanup at cursor #${cursor} in ${componentInstance.name}`);
|
||||||
handleError(err);
|
handleError(err);
|
||||||
} finally {
|
|
||||||
byCursor[cursor].cleanup = undefined;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
byCursor[cursor].cleanup = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
function exec() {
|
function exec() {
|
||||||
@ -628,8 +623,6 @@ function useEffectBase(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
execCleanup();
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// 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;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user