Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Open
Alfred-Skyblue wants to merge 2 commits into vuejs:main
base: main
Choose a base branch
Loading
from Alfred-Skyblue:docs/watchEffect

Conversation

Copy link
Member

@Alfred-Skyblue Alfred-Skyblue commented Dec 8, 2023
edited
Loading

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 an if statement with a false condition during the initial execution, leading to uncollected dependencies. These errors can cause watchEffect 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.

Copy link

netlify bot commented Dec 8, 2023
edited
Loading

Deploy Preview for vuejs ready!

Name Link
🔨 Latest commit d5fc7f9
🔍 Latest deploy log https://app.netlify.com/sites/vuejs/deploys/65784d5ca334770008c89d1e
😎 Deploy Preview https://deploy-preview-2596--vuejs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

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.

Alfred-Skyblue reacted with thumbs up emoji

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /