Skip to content

Commit 0369952

Browse files
陆德靖陆德靖
陆德靖
authored and
陆德靖
committed
fix: update app initialization logic in devtools container management
1 parent 06f5d42 commit 0369952

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Diff for: packages/overlay/src/main.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { Component, App as VueAppType } from 'vue'
22
import { createApp, h } from 'vue'
33
import App from './App.vue'
44

5-
let app: VueAppType
5+
let app: VueAppType | null = null
66
function createDevToolsContainer(App: Component) {
77
const CONTAINER_ID = '__vue-devtools-container__'
88
const el = document.createElement('div')
@@ -25,15 +25,15 @@ const config = { childList: true, attributes: false }
2525
const observer = new MutationObserver(callback)
2626
observer.observe(targetNode, config)
2727

28-
let init = false
28+
let isInitialized = false
2929
function callback(mutationsList, observer) {
3030
for (const mutation of mutationsList) {
31-
if (mutation.type === 'childList' && init === false) {
31+
if (mutation.type === 'childList' && isInitialized === false) {
3232
if (app) {
3333
app.unmount()
3434
}
3535
createDevToolsContainer(App)
36-
init = true
36+
isInitialized = true
3737
observer.disconnect()
3838
}
3939
}

0 commit comments

Comments
 (0)