Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reactivity: only subscribe components during rendering #1574

Open
sdegueldre opened this issue Jan 3, 2024 · 0 comments
Open

Reactivity: only subscribe components during rendering #1574

sdegueldre opened this issue Jan 3, 2024 · 0 comments
Labels
owl-3 features for owl 3 reactivity
Milestone

Comments

@sdegueldre
Copy link
Contributor

It's pretty common to have event handlers that mutate the state, and in doing so, need to read the current state.

Currently, this subscribes the component and immediately re-renders it, even though in practice the DOM of the component does not depend on the value that was written

Playground example

One workaround for this is to wrap the reactive object that we're about to modify in a fresh reactive with no callback, but this is not ergonomic and unintuitive

Playground example

Ideally, reactives bound to components should only subscribe to keys that are read during rendering or a rendering-adjacent activity (willRender/rendered/willPatch/patched)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
owl-3 features for owl 3 reactivity
Projects
None yet
Development

No branches or pull requests

1 participant