From a5f7426e537c5241f19a36cbaf084df8e90d7dba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A1=8D=E8=89=AF?= Date: Thu, 19 Aug 2021 20:01:53 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8F=81=20use=20promise.catch=20to=20simul?= =?UTF-8?q?ate=20promise.finally=20for=20compatible=20reason=20(#1664)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: chemdemo --- src/apis.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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); } }