Skip to content

Commit

Permalink
fix: instanceMap of null, fixes #1446
Browse files Browse the repository at this point in the history
  • Loading branch information
Akryum committed May 24, 2021
1 parent 51c7e74 commit 5d6ba0e
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions packages/app-backend-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import {
createBackendContext,
BackendContext,
Plugin,
BuiltinBackendFeature
BuiltinBackendFeature,
AppRecord
} from '@vue-devtools/app-backend-api'
import {
Bridge,
Expand Down Expand Up @@ -129,9 +130,17 @@ async function connect () {
})

hook.on(HookEvents.COMPONENT_UPDATED, (app, uid) => {
const id = app ? getComponentId(app, uid, ctx) : ctx.currentInspectedComponentId
let id: string
let appRecord: AppRecord
if (app && uid != null) {
id = getComponentId(app, uid, ctx)
appRecord = getAppRecord(app, ctx)
} else {
id = ctx.currentInspectedComponentId
appRecord = ctx.currentAppRecord
}
if (id && isSubscribed(BridgeSubscriptions.SELECTED_COMPONENT_DATA, sub => sub.payload.instanceId === id)) {
sendSelectedComponentData(getAppRecord(app, ctx), id, ctx)
sendSelectedComponentData(appRecord, id, ctx)
}
})

Expand Down

0 comments on commit 5d6ba0e

Please sign in to comment.