@@ -77,6 +77,42 @@ class VDomUpdate extends Collection {
7777 item . children . push ( { childId, resolve} ) ;
7878 }
7979
80+ /**
81+ * Calculates the adjusted updateDepth for a parent component based on its merged children.
82+ * This method is called by the parent component right before it executes its own VDOM update.
83+ * @param {String } ownerId
84+ * @returns {Number|null } The adjusted update depth or null if no merged children are found
85+ */
86+ getAdjustedUpdateDepth ( ownerId ) {
87+ let me = this ,
88+ owner = Neo . getComponent ( ownerId ) ,
89+ item = me . mergedCallbackMap . get ( ownerId ) ,
90+ maxDepth = owner ?. updateDepth ?? 1 ,
91+ newDepth ;
92+
93+ if ( item ) {
94+ item . children . forEach ( child => {
95+ if ( child . childUpdateDepth === - 1 ) {
96+ newDepth = - 1 ;
97+ } else {
98+ // The new depth is the distance to the child plus its own update depth,
99+ // minus 1 because the child's root is at the parent's level 1.
100+ newDepth = child . distance + child . childUpdateDepth - 1 ;
101+ }
102+
103+ if ( newDepth === - 1 ) {
104+ maxDepth = - 1 ;
105+ } else if ( maxDepth !== - 1 ) {
106+ maxDepth = Math . max ( maxDepth , newDepth ) ;
107+ }
108+ } ) ;
109+
110+ return maxDepth ;
111+ }
112+
113+ return null ;
114+ }
115+
80116 /**
81117 * @param {String } ownerId
82118 */
@@ -85,7 +121,9 @@ class VDomUpdate extends Collection {
85121 item = me . mergedCallbackMap . get ( ownerId ) ;
86122
87123 if ( item ) {
88- item . callbacks . forEach ( callback => callback ( ) ) ;
124+ item . children . forEach ( child => {
125+ child . callbacks . forEach ( callback => callback ( ) ) ;
126+ } ) ;
89127 me . mergedCallbackMap . remove ( item ) ;
90128 }
91129 }
0 commit comments