Skip to content

Conversation

helloann
Copy link

watch() will share the same flush timing、 debugging options、cleanup callback and stopping the watcher with watchEffect():

Description of Problem

It's only flush timing、 debugging options. Lack of cleanup callback and stopping handler.

Proposed Solution

Add cleanup callback and stopping handler.

Additional Information

watch() will share the same flush timing、 debugging options、cleanup callback and stopping the watcher with watchEffect():
@netlify
Copy link

netlify bot commented Nov 22, 2022

Deploy Preview for vuejs ready!

Name Link
🔨 Latest commit e54e06c
🔍 Latest deploy log https://app.netlify.com/sites/vuejs/deploys/637c42c3032d6c0009746fc2
😎 Deploy Preview https://deploy-preview-2102--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 settings.

@skirtles-code
Copy link
Contributor

Thanks for the PR! Sorry for the delay in getting back to you.

I've just opened #2155, which attempts to address the same problem. I appreciate the effort you put into creating those examples, but I felt there were some problems with them that would have taken time to fix and it was much quicker for me just to open a new PR.

If you're interested, here are some of the concerns I had:

  • We're already in the Example section, so there's no need to repeat that heading.
  • The text introducing these examples was using a character in place of a comma.
  • The examples didn't need to be numbered, they are already in the examples section.
  • The Side effect cleanup example was inconsistent in its use of count and id. The comment mentions id, when I believe it should mention count. The final line also updates count.value, which seems unlikely to be correct in this context.
  • The example for Stopping the watcher seemed unnecessarily complex. Compare that to the equivalent example for watchEffect().

Thanks again for highlighting this gap in the docs and please feel free to give any feedback you have on the changes I've proposed in #2155.

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.

2 participants