diff --git a/packages/devtools-kit/src/core/index.ts b/packages/devtools-kit/src/core/index.ts index 28071dfb..d60884a0 100644 --- a/packages/devtools-kit/src/core/index.ts +++ b/packages/devtools-kit/src/core/index.ts @@ -56,7 +56,7 @@ export function initDevTools() { }, ] - if (devtoolsAppRecords.value.length >= 1) { + if (devtoolsAppRecords.value.length === 1) { await setActiveAppRecord(devtoolsAppRecords.value[0]) devtoolsState.connected = true devtoolsHooks.callHook(DevToolsHooks.APP_CONNECTED) @@ -65,11 +65,6 @@ export function initDevTools() { hook.on.vueAppUnmount(async (app) => { const activeRecords = devtoolsAppRecords.value.filter(appRecord => appRecord.app !== app) - // #356 should disconnect when all apps are unmounted - if (activeRecords.length === 0) { - devtoolsState.connected = false - return - } devtoolsAppRecords.value = activeRecords if (devtoolsAppRecords.active.app === app) await setActiveAppRecord(activeRecords[0]) diff --git a/packages/playground/multi-app/src/main.ts b/packages/playground/multi-app/src/main.ts index 65ea9acb..61ab5943 100644 --- a/packages/playground/multi-app/src/main.ts +++ b/packages/playground/multi-app/src/main.ts @@ -8,10 +8,8 @@ import 'uno.css' const app = createApp(App) +const app2 = createApp(App2) + app.mount('#app') -setTimeout(() => { - app.unmount() - app.mount('#app') - createApp(App2).mount('#app2') -}, 500) +app2.mount('#app2')