From 5d6ba0e4925646a3ed52e737043bf4574e2ba9d5 Mon Sep 17 00:00:00 2001 From: Guillaume Date: Mon, 24 May 2021 18:22:43 +0200 Subject: [PATCH] fix: instanceMap of null, fixes #1446 --- packages/app-backend-core/src/index.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/packages/app-backend-core/src/index.ts b/packages/app-backend-core/src/index.ts index ff0d3c9cc..5ee010206 100644 --- a/packages/app-backend-core/src/index.ts +++ b/packages/app-backend-core/src/index.ts @@ -2,7 +2,8 @@ import { createBackendContext, BackendContext, Plugin, - BuiltinBackendFeature + BuiltinBackendFeature, + AppRecord } from '@vue-devtools/app-backend-api' import { Bridge, @@ -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) } })