@@ -313,6 +313,25 @@ class FunctionalBase extends Base {
313313 }
314314 } ) ;
315315
316+ // If this component created other classic or functional components,
317+ // include their full vdom into the next update cycle.
318+ const oldKeys = me . childComponents ? new Set ( me . childComponents . keys ( ) ) : new Set ( ) ;
319+ let hasNewChildren = false ;
320+
321+ for ( const newKey of me . #nextChildComponents. keys ( ) ) {
322+ if ( ! oldKeys . has ( newKey ) ) {
323+ hasNewChildren = true ;
324+ break
325+ }
326+ }
327+
328+ if ( hasNewChildren ) {
329+ // When new child components are created, we need to send their full VDOM
330+ // to the vdom-worker, so they can get rendered.
331+ // Subsequent updates will be granular via diffAndSet() => set() on the child.
332+ me . updateDepth = - 1 ;
333+ }
334+
316335 // Update the main map of instantiated components
317336 me . childComponents = me . #nextChildComponents;
318337
@@ -336,25 +355,6 @@ class FunctionalBase extends Base {
336355 root . id = me . id
337356 }
338357
339- // If this component created other classic or functional components,
340- // include their full vdom into the next update cycle.
341- const oldKeys = me . childComponents ? new Set ( me . childComponents . keys ( ) ) : new Set ( ) ;
342- let hasNewChildren = false ;
343-
344- for ( const newKey of me . #nextChildComponents. keys ( ) ) {
345- if ( ! oldKeys . has ( newKey ) ) {
346- hasNewChildren = true ;
347- break
348- }
349- }
350-
351- if ( hasNewChildren ) {
352- // When new child components are created, we need to send their full VDOM
353- // to the vdom-worker, so they can get rendered.
354- // Subsequent updates will be granular via diffAndSet() => set() on the child.
355- me . updateDepth = - 1 ;
356- }
357-
358358 me . updateVdom ( ) ;
359359
360360 // Update DOM event listeners based on the new render
0 commit comments