Skip to content

Commit

Permalink
Revert "fix: disconnect when all apps are unmount (#357)"
Browse files Browse the repository at this point in the history
This reverts commit a12c816.
  • Loading branch information
webfansplz authored May 19, 2024
1 parent fdac6eb commit 06854c7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
7 changes: 1 addition & 6 deletions packages/devtools-kit/src/core/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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])
Expand Down
8 changes: 3 additions & 5 deletions packages/playground/multi-app/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')

0 comments on commit 06854c7

Please sign in to comment.