From 07bfd9f38fb6abaa4d559ab4d6f4388ab88eee75 Mon Sep 17 00:00:00 2001 From: Chen Zhouji Date: Thu, 2 Dec 2021 21:28:44 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20add=20`autoStart`=20config=20to=20`?= =?UTF-8?q?loadMicroApp`=20(#1854)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/apis.ts b/src/apis.ts index 2bcfc6f..e3758ba 100644 --- a/src/apis.ts +++ b/src/apis.ts @@ -80,7 +80,7 @@ const containerMicroAppsMap = new Map(); export function loadMicroApp( app: LoadableApp, - configuration?: FrameworkConfiguration, + configuration?: FrameworkConfiguration & { autoStart?: boolean }, lifeCycles?: FrameworkLifeCycles, ): MicroApp { const { props, name } = app; @@ -161,7 +161,7 @@ export function loadMicroApp( return (await parcelConfigObjectGetterPromise)(container); }; - if (!started) { + if (!started && configuration?.autoStart !== false) { // We need to invoke start method of single-spa as the popstate event should be dispatched while the main app calling pushState/replaceState automatically, // but in single-spa it will check the start status before it dispatch popstate // see https://github.com/single-spa/single-spa/blob/f28b5963be1484583a072c8145ac0b5a28d91235/src/navigation/navigation-events.js#L101