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

Chained 'pre' watchers #1777

Closed
skirtles-code opened this issue Aug 4, 2020 · 0 comments
Closed

Chained 'pre' watchers #1777

skirtles-code opened this issue Aug 4, 2020 · 0 comments

Comments

@skirtles-code
Copy link
Contributor

Version

master at commit 11ed210

The example is using a build of the latest master branch as it relies on a commit that went in yesterday . I'm unclear whether there's a better way to report problems against the latest master.

Reproduction link

https://codesandbox.io/s/holy-sunset-fc8di?file=/index.html

Steps to reproduce

  1. Open the console log.
  2. Click the button.
  3. Note that the watcher for otherValue isn't called until after render, despite being flush: 'pre'.

What is expected?

Changes made by a 'pre' watcher should trigger other 'pre' watchers prior to any rendering.

In Vue 2 this kind of watcher chaining worked fine, see:

https://jsfiddle.net/skirtle/vnkxz35p/9/

What is actually happening?

The second 'pre' watcher isn't called until after render.


Why do you need a watcher that runs before render?

The example is for illustration only. I've explained in greater detail here why this is important in real applications.

Why not use flush: 'sync' on that second watcher?

In this simple example that would work.

But using 'sync' brings its own problems, such as those discussed in #1763. If the watcher were watching a computed property that also depended on props it wouldn't be viable to use 'sync'.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant