Skip to content

Commit 8ade033

Browse files
committed
#7076 functional.component.Base: onEffectRunStateChange() => depth check fix
1 parent 6b8bf1a commit 8ade033

2 files changed

Lines changed: 20 additions & 20 deletions

File tree

src/functional/component/Base.mjs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -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

src/mixin/VdomLifecycle.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -680,4 +680,4 @@ class VdomLifecycle extends Base {
680680

681681
Neo.setupClass(VdomLifecycle);
682682

683-
export default VdomLifecycle;
683+
export default VdomLifecycle;

0 commit comments

Comments
 (0)