1- import { AppRecord , BackendContext } from '@vue-devtools/app-backend-api'
1+ import { AppRecord , BackendContext , DevtoolsApi } from '@vue-devtools/app-backend-api'
22import { classify } from '@vue-devtools/shared-utils'
33import { ComponentTreeNode } from '@vue/devtools-api'
44import { getInstanceOrVnodeRect } from './el'
@@ -8,6 +8,7 @@ export let instanceMap: Map<any, any>
88export let functionalVnodeMap : Map < any , any >
99
1010let appRecord : AppRecord
11+ let api : DevtoolsApi
1112
1213const consoleBoundInstances = Array ( 5 )
1314
@@ -53,6 +54,7 @@ export function getComponentParents (instance, ctx: BackendContext) {
5354
5455function initCtx ( ctx : BackendContext ) {
5556 appRecord = ctx . currentAppRecord
57+ api = ctx . api
5658 if ( ! appRecord . meta . instanceMap ) {
5759 appRecord . meta . instanceMap = new Map ( )
5860 }
@@ -175,7 +177,7 @@ function capture (instance, index?: number, list?: any[]): ComponentTreeNode {
175177 // router-view has both fnContext and componentInstance on vnode.
176178 : instance . componentInstance ? [ capture ( instance . componentInstance ) ] : [ ] ) . filter ( Boolean )
177179
178- return {
180+ const treeNode = {
179181 uid : functionalId ,
180182 id : functionalId ,
181183 tags : [
@@ -192,6 +194,12 @@ function capture (instance, index?: number, list?: any[]): ComponentTreeNode {
192194 inactive : false ,
193195 isFragment : false // TODO: Check what is it for.
194196 }
197+ return api . visitComponentTree (
198+ instance ,
199+ treeNode ,
200+ filter ,
201+ appRecord ?. options ?. app
202+ )
195203 }
196204 // instance._uid is not reliable in devtools as there
197205 // may be 2 roots with same _uid which causes unexpected
@@ -266,7 +274,12 @@ function capture (instance, index?: number, list?: any[]): ComponentTreeNode {
266274 backgroundColor : 0xff8344
267275 } )
268276 }
269- return ret
277+ return api . visitComponentTree (
278+ instance ,
279+ ret ,
280+ filter ,
281+ appRecord ?. options ?. app
282+ )
270283}
271284
272285/**
0 commit comments