Skip to content

Commit 5d6ba0e

Browse files
committed
fix: instanceMap of null, fixes #1446
1 parent 51c7e74 commit 5d6ba0e

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

packages/app-backend-core/src/index.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import {
22
createBackendContext,
33
BackendContext,
44
Plugin,
5-
BuiltinBackendFeature
5+
BuiltinBackendFeature,
6+
AppRecord
67
} from '@vue-devtools/app-backend-api'
78
import {
89
Bridge,
@@ -129,9 +130,17 @@ async function connect () {
129130
})
130131

131132
hook.on(HookEvents.COMPONENT_UPDATED, (app, uid) => {
132-
const id = app ? getComponentId(app, uid, ctx) : ctx.currentInspectedComponentId
133+
let id: string
134+
let appRecord: AppRecord
135+
if (app && uid != null) {
136+
id = getComponentId(app, uid, ctx)
137+
appRecord = getAppRecord(app, ctx)
138+
} else {
139+
id = ctx.currentInspectedComponentId
140+
appRecord = ctx.currentAppRecord
141+
}
133142
if (id && isSubscribed(BridgeSubscriptions.SELECTED_COMPONENT_DATA, sub => sub.payload.instanceId === id)) {
134-
sendSelectedComponentData(getAppRecord(app, ctx), id, ctx)
143+
sendSelectedComponentData(appRecord, id, ctx)
135144
}
136145
})
137146

0 commit comments

Comments
 (0)