Skip to content

Commit 5669487

Browse files
committed
Enable support for nesting functional components #7057
1 parent a07db5d commit 5669487

1 file changed

Lines changed: 15 additions & 8 deletions

File tree

src/functional/component/Base.mjs

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -275,10 +275,7 @@ class FunctionalBase extends Base {
275275

276276
if (!Neo.isEqual(newValue, oldValue)) {
277277
// If the config property is an object and it maps to a sub-component instance, recurse.
278-
if (
279-
Neo.typeOf(newValue) === 'Object' &&
280-
Neo.typeOf(instance[key]) === 'NeoInstance'
281-
) {
278+
if (Neo.typeOf(newValue) === 'Object' && Neo.typeOf(instance[key]) === 'NeoInstance') {
282279
this.diffAndSet(instance[key], newValue, oldValue || {})
283280
} else {
284281
// Otherwise, add it to the delta to be set on the current instance.
@@ -343,6 +340,13 @@ class FunctionalBase extends Base {
343340
root.id = me.id
344341
}
345342

343+
// If this component created other classic or functional components,
344+
// include their full vdom into the next update cycle.
345+
// We could make this more granular inside the future.
346+
if (me.childComponents?.size > 0) {
347+
me.updateDepth = -1
348+
}
349+
346350
me.updateVdom();
347351

348352
// Update DOM event listeners based on the new render
@@ -388,9 +392,8 @@ class FunctionalBase extends Base {
388392
)
389393
}
390394

391-
let childData = me.childComponents?.get(componentKey),
392-
newConfig = {...vdomTree}, // Shallow copy
393-
deltaConfig = {},
395+
let childData = me.childComponents?.get(componentKey),
396+
newConfig = {...vdomTree}, // Shallow copy
394397
instance;
395398

396399
delete newConfig.className;
@@ -407,7 +410,11 @@ class FunctionalBase extends Base {
407410
parentId,
408411
parentIndex,
409412
windowId: me.windowId
410-
})
413+
});
414+
415+
if (instance instanceof Neo.functional.component.Base) {
416+
instance.onEffectRunStateChange(false, true)
417+
}
411418
} else {
412419
instance = childData.instance;
413420

0 commit comments

Comments
 (0)