-
-
Notifications
You must be signed in to change notification settings - Fork 8.9k
Description
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
- Open the console log.
- Click the button.
- Note that the watcher for
otherValue
isn't called until afterrender
, despite beingflush: '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'
.