Skip to content

Commit ef80af5

Browse files
committed
#7022 functional.component.Base: adjusted the vdom setter to change its backing value, fixed a wrong hookIndex access inside vdomEffect.
1 parent 436afb3 commit ef80af5

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

src/functional/component/Base.mjs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class FunctionalBase extends Base {
4545
return this._vdom
4646
}
4747
set vdom(value) {
48+
this._vdom = value;
4849
this.afterSetVdom(value, value)
4950
}
5051

@@ -73,12 +74,12 @@ class FunctionalBase extends Base {
7374

7475
// Creates a reactive effect that re-executes createVdom() when dependencies change.
7576
me.vdomEffect = new Effect(() => {
76-
me._hookIndex = 0;
77+
me[hookIndexSymbol] = 0;
7778

78-
// Assign to the private backing property to prevent immediate VDOM worker updates,
79-
// allowing the public vdom setter (via afterSetVdom) to manage the update cycle.
80-
me._vdom = me.createVdom(me, me.data);
81-
me.update()
79+
// By assigning to the public `vdom` property, we trigger the setter,
80+
// which in turn calls `afterSetVdom` from the VdomLifecycle mixin.
81+
// This ensures the standard component update process is followed.
82+
me.vdom = me.createVdom(me, me.data)
8283
}, me.id)
8384
}
8485

0 commit comments

Comments
 (0)