diff --git a/src/apis.ts b/src/apis.ts index a9bf179..5e5ed44 100644 --- a/src/apis.ts +++ b/src/apis.ts @@ -167,13 +167,15 @@ export function loadMicroApp( microAppsRef.push(microApp); containerMicroAppsMap.set(key, microAppsRef); - // gc after unmount - microApp.unmountPromise.finally(() => { + const cleanApp = () => { const index = microAppsRef.indexOf(microApp); microAppsRef.splice(index, 1); // @ts-ignore microApp = null; - }); + }; + + // gc after unmount + microApp.unmountPromise.then(cleanApp).catch(cleanApp); } }