@@ -152,11 +152,14 @@ async function connect () {
152152 if ( parentUid != null ) {
153153 const parentInstances = await appRecord . backend . api . walkComponentParents ( component )
154154 if ( parentInstances . length ) {
155- const parentId = await getComponentId ( app , parentUid , parentInstances [ 0 ] , ctx )
156- if ( isSubscribed ( BridgeSubscriptions . COMPONENT_TREE , sub => sub . payload . instanceId === parentId ) ) {
157- requestAnimationFrame ( ( ) => {
158- sendComponentTreeData ( appRecord , parentId , appRecord . componentFilter , null , ctx )
159- } )
155+ // Check two parents level to update `hasChildren
156+ for ( let i = 0 ; i < 2 && i < parentInstances . length ; i ++ ) {
157+ const parentId = await getComponentId ( app , parentUid , parentInstances [ i ] , ctx )
158+ if ( isSubscribed ( BridgeSubscriptions . COMPONENT_TREE , sub => sub . payload . instanceId === parentId ) ) {
159+ requestAnimationFrame ( ( ) => {
160+ sendComponentTreeData ( appRecord , parentId , appRecord . componentFilter , null , ctx )
161+ } )
162+ }
160163 }
161164 }
162165 }
@@ -359,6 +362,7 @@ function connectBridge () {
359362 ctx . bridge . on ( BridgeEvents . TO_BACK_COMPONENT_TREE , ( { instanceId, filter } ) => {
360363 ctx . currentAppRecord . componentFilter = filter
361364 sendComponentTreeData ( ctx . currentAppRecord , instanceId , filter , null , ctx )
365+ subscribe ( BridgeSubscriptions . COMPONENT_TREE , { instanceId } )
362366 } )
363367
364368 ctx . bridge . on ( BridgeEvents . TO_BACK_COMPONENT_SELECTED_DATA , ( instanceId ) => {
0 commit comments