@@ -174,12 +174,14 @@ async function connect () {
174
174
if ( component . __VUE_DEVTOOLS_UID__ == null ) {
175
175
component . __VUE_DEVTOOLS_UID__ = id
176
176
}
177
- if ( ! appRecord . instanceMap . has ( id ) ) {
178
- appRecord . instanceMap . set ( id , component )
177
+ if ( appRecord ?. instanceMap ) {
178
+ if ( ! appRecord . instanceMap . has ( id ) ) {
179
+ appRecord . instanceMap . set ( id , component )
180
+ }
179
181
}
180
182
}
181
183
182
- if ( parentUid != null ) {
184
+ if ( parentUid != null && appRecord ?. instanceMap ) {
183
185
const parentInstances = await appRecord . backend . api . walkComponentParents ( component )
184
186
if ( parentInstances . length ) {
185
187
// Check two parents level to update `hasChildren
@@ -222,14 +224,18 @@ async function connect () {
222
224
try {
223
225
if ( ! app || ( typeof uid !== 'number' && ! uid ) || ! component ) return
224
226
const appRecord = await getAppRecord ( app , ctx )
225
- if ( parentUid != null ) {
227
+ if ( parentUid != null && appRecord ) {
226
228
const parentInstances = await appRecord . backend . api . walkComponentParents ( component )
227
229
if ( parentInstances . length ) {
228
230
const parentId = await getComponentId ( app , parentUid , parentInstances [ 0 ] , ctx )
229
231
if ( isSubscribed ( BridgeSubscriptions . COMPONENT_TREE , sub => sub . payload . instanceId === parentId ) ) {
230
232
raf ( async ( ) => {
231
233
try {
232
- sendComponentTreeData ( await getAppRecord ( app , ctx ) , parentId , appRecord . componentFilter , null , false , ctx )
234
+ const appRecord = await getAppRecord ( app , ctx )
235
+
236
+ if ( appRecord ) {
237
+ sendComponentTreeData ( appRecord , parentId , appRecord . componentFilter , null , false , ctx )
238
+ }
233
239
} catch ( e ) {
234
240
if ( SharedData . debugInfo ) {
235
241
console . error ( e )
@@ -244,7 +250,10 @@ async function connect () {
244
250
if ( isSubscribed ( BridgeSubscriptions . SELECTED_COMPONENT_DATA , sub => sub . payload . instanceId === id ) ) {
245
251
await sendEmptyComponentData ( id , ctx )
246
252
}
247
- appRecord . instanceMap . delete ( id )
253
+
254
+ if ( appRecord ) {
255
+ appRecord . instanceMap . delete ( id )
256
+ }
248
257
249
258
await refreshComponentTreeSearch ( ctx )
250
259
} catch ( e ) {
@@ -288,13 +297,15 @@ async function connect () {
288
297
289
298
hook . on ( HookEvents . TIMELINE_LAYER_ADDED , async ( options : TimelineLayerOptions , plugin : Plugin ) => {
290
299
const appRecord = await getAppRecord ( plugin . descriptor . app , ctx )
291
- ctx . timelineLayers . push ( {
292
- ...options ,
293
- appRecord,
294
- plugin,
295
- events : [ ] ,
296
- } )
297
- ctx . bridge . send ( BridgeEvents . TO_FRONT_TIMELINE_LAYER_ADD , { } )
300
+ if ( appRecord ) {
301
+ ctx . timelineLayers . push ( {
302
+ ...options ,
303
+ appRecord,
304
+ plugin,
305
+ events : [ ] ,
306
+ } )
307
+ ctx . bridge . send ( BridgeEvents . TO_FRONT_TIMELINE_LAYER_ADD , { } )
308
+ }
298
309
} )
299
310
300
311
hook . on ( HookEvents . TIMELINE_EVENT_ADDED , async ( options : TimelineEventOptions , plugin : Plugin ) => {
@@ -305,14 +316,16 @@ async function connect () {
305
316
306
317
hook . on ( HookEvents . CUSTOM_INSPECTOR_ADD , async ( options : CustomInspectorOptions , plugin : Plugin ) => {
307
318
const appRecord = await getAppRecord ( plugin . descriptor . app , ctx )
308
- ctx . customInspectors . push ( {
309
- ...options ,
310
- appRecord,
311
- plugin,
312
- treeFilter : '' ,
313
- selectedNodeId : null ,
314
- } )
315
- ctx . bridge . send ( BridgeEvents . TO_FRONT_CUSTOM_INSPECTOR_ADD , { } )
319
+ if ( appRecord ) {
320
+ ctx . customInspectors . push ( {
321
+ ...options ,
322
+ appRecord,
323
+ plugin,
324
+ treeFilter : '' ,
325
+ selectedNodeId : null ,
326
+ } )
327
+ ctx . bridge . send ( BridgeEvents . TO_FRONT_CUSTOM_INSPECTOR_ADD , { } )
328
+ }
316
329
} )
317
330
318
331
hook . on ( HookEvents . CUSTOM_INSPECTOR_SEND_TREE , async ( inspectorId : string , plugin : Plugin ) => {
0 commit comments