Skip to content

reactive props#1912

Merged
ged-odoo merged 1 commit into
masterfrom
master-props-revamp-ged
Jun 5, 2026
Merged

reactive props#1912
ged-odoo merged 1 commit into
masterfrom
master-props-revamp-ged

Conversation

@ged-odoo
Copy link
Copy Markdown
Contributor

@ged-odoo ged-odoo commented Jun 3, 2026

Reading a prop inside an effect/computed did not react to the same changes the template reacted to. Props participated only in the forced-render channel (parent re-render -> arePropsDifferent -> wholesale node.props replacement + fiber.render), not in the reactive channel: props() getters did a plain node.props[key] read, so the prop slot was not an atom and swapping a prop value was invisible to effects/computed.

Back each declared prop key with a signal used purely as a notification atom: the getter subscribes the current computation but returns the live node.props value. Notifications fire from a new node.propsUpdated list, invoked right after node.props is applied (sync and async branches) so that reads inside onWillUpdateProps still see the old value and async hooks observe the applied value. The synchronous forced render resets the render computation to EXECUTED before the batched microtask, so no extra render is introduced.

prop() (static, reference-stable) stays non-reactive.

@ged-odoo ged-odoo force-pushed the master-props-revamp-ged branch 2 times, most recently from be7f635 to 16e2f2d Compare June 3, 2026 12:57
Reading a prop inside an effect/computed did not react to the same changes the template reacted to. Props participated only in the forced-render channel (parent re-render -> arePropsDifferent -> node.props replacement + fiber.render), while props() getters performed plain reads that were invisible to the reactive system.

Expose props through signal-backed getters so reading this.props.x subscribes the current computation, and refresh those signals after node.props is updated on parent re-render. This keeps onWillUpdateProps observing the previous this.props value while effects/computed rerun with the applied value on the next microtask.

For declared props, the key set is fixed and only the existing signals are refreshed. Bare props() still tracks runtime key additions/removals because t-props can change the prop object shape across renders.

prop() remains static and reference-stable.
@ged-odoo ged-odoo force-pushed the master-props-revamp-ged branch from 16e2f2d to 0c4372f Compare June 4, 2026 14:00
@ged-odoo ged-odoo merged commit 80f3a3b into master Jun 5, 2026
2 checks passed
@ged-odoo ged-odoo deleted the master-props-revamp-ged branch June 5, 2026 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant