-
Notifications
You must be signed in to change notification settings - Fork 4.8k
docs: add watchEffect
notes
#2596
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
Conversation
✅ Deploy Preview for vuejs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
fabruex
commented
Dec 12, 2023
Hi, I saw this pull request and I would add this point from last comment by LinusBorg in vuejs/core#9773, I think it's very important and clear:
reactive dependencies are re-collected on each run of an effect. This is so that a) new dependencies, that might not have been accessed/read from in a previous run, can be read, and b) old dependencies, that are no longer being read from in the latest run, can be discarded.
Uh oh!
There was an error while loading. Please reload this page.
Description of Problem
I have observed that users often make some mistakes when using
watchEffect
, such as asynchronously accessing reactive variables, resulting in dependencies not being collected, or having anif
statement with a false condition during the initial execution, leading to uncollected dependencies. These errors can causewatchEffect
to malfunction. In this pull request, I have added some notes to help users avoid these mistakes.relate: vuejs/core#9773 vuejs/core#9408 vuejs/core#2093
Proposed Solution
Additional Information
My English is not very good. You can correct my grammar or inaccurate wording at will. Thank you.