@@ -152,11 +152,14 @@ async function connect () {
152
152
if ( parentUid != null ) {
153
153
const parentInstances = await appRecord . backend . api . walkComponentParents ( component )
154
154
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
+ }
160
163
}
161
164
}
162
165
}
@@ -359,6 +362,7 @@ function connectBridge () {
359
362
ctx . bridge . on ( BridgeEvents . TO_BACK_COMPONENT_TREE , ( { instanceId, filter } ) => {
360
363
ctx . currentAppRecord . componentFilter = filter
361
364
sendComponentTreeData ( ctx . currentAppRecord , instanceId , filter , null , ctx )
365
+ subscribe ( BridgeSubscriptions . COMPONENT_TREE , { instanceId } )
362
366
} )
363
367
364
368
ctx . bridge . on ( BridgeEvents . TO_BACK_COMPONENT_SELECTED_DATA , ( instanceId ) => {
0 commit comments