-
Notifications
You must be signed in to change notification settings - Fork 343
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
[perf] props (reactive object) should not be observed outside of rendering #1601
Comments
seb-odoo
changed the title
props (reactive object) should not be observed outside of rendering
[performance] props (reactive object) should not be observed outside of rendering
Mar 29, 2024
seb-odoo
changed the title
[performance] props (reactive object) should not be observed outside of rendering
[perf] props (reactive object) should not be observed outside of rendering
Mar 29, 2024
yep, we know, and i think that we agree. |
duplicate #1574 ? |
good catch. yes, exactly. closing this then. Thanks for caring enough to make an issue |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What is observed?
Reactive props are always observed, even if they are used outside of the render.
Why is it bad?
This leads to extra renders when the value changes, which can be problematic for performance if the render is costly or happening many times.
Solution?
When the value of a props is used outside of rendering, it should not be observed and its change should not trigger a re-render.
Example
playground
Prints:
1
, then2
Expected: only
1
The text was updated successfully, but these errors were encountered: