🏁 use promise.catch to simulate promise.finally for compatible reason (#1664)
Co-authored-by: chemdemo <chemdemo@gmail.com>
This commit is contained in:
parent
69af3a1be4
commit
a5f7426e53
|
|
@ -167,13 +167,15 @@ export function loadMicroApp<T extends ObjectType>(
|
||||||
microAppsRef.push(microApp);
|
microAppsRef.push(microApp);
|
||||||
containerMicroAppsMap.set(key, microAppsRef);
|
containerMicroAppsMap.set(key, microAppsRef);
|
||||||
|
|
||||||
// gc after unmount
|
const cleanApp = () => {
|
||||||
microApp.unmountPromise.finally(() => {
|
|
||||||
const index = microAppsRef.indexOf(microApp);
|
const index = microAppsRef.indexOf(microApp);
|
||||||
microAppsRef.splice(index, 1);
|
microAppsRef.splice(index, 1);
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
microApp = null;
|
microApp = null;
|
||||||
});
|
};
|
||||||
|
|
||||||
|
// gc after unmount
|
||||||
|
microApp.unmountPromise.then(cleanApp).catch(cleanApp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user