Mixins watchers not triggered when watching same property
Version
3.1.1
Reproduction link
https://codesandbox.io/s/friendly-burnell-n27xm?file=/src/components/HelloWorld.vue
SFC Playground Clicking the button should display 3 times the change like in 3.0.11
Steps to reproduce
- Component and mixins to watch the same property (in this case, vue router
$route
) - Click each of the router link to trigger the watchers
What is expected?
In 3.0.11, component and all its mixin watchers triggered
What is actually happening?
In 3.1.1, only the component watcher got triggered
I added an SFC playground without the router. It seems like the mixins watchers are being overridden instead of merged together so only the Component watcher is kept
e2ca67b#diff-07826ed1d9f7699d925ee15d9212e2879af5320b155c0c878fc2dcba71b3e564L110-L113
This seems to be intentional.
Yes, I saw these comment too. But I still think maybe we need triggered all watch in mixins. So I open a PR to fix it.
Maybe we can discuss this behavior, and if we really don't need this feature, I will close that PR.
e2ca67b#diff-07826ed1d9f7699d925ee15d9212e2879af5320b155c0c878fc2dcba71b3e564L110-L113
This seems to be intentional.
I also agree this breaking change is not intentional, the code commit specifically to align Vue 2 merge behaviors but fall short on the watch merging on same property.
From the SFC playground created by @posva, it works until Vue 3.1.0-beta7
It also works on Vue 2.x which I recreate the minimal reproduction below: https://codesandbox.io/s/competent-bardeen-sidl3?file=/src/App.vue