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

Mixins watchers not triggered when watching same property #3966

Closed
yuripave opened this issue Jun 16, 2021 · 5 comments
Closed

Mixins watchers not triggered when watching same property #3966

yuripave opened this issue Jun 16, 2021 · 5 comments
Labels
❗ p4-important Priority 4: this fixes bugs that violate documented behavior, or significantly improves perf. 🐞 bug Something isn't working

Comments

@yuripave
Copy link

yuripave commented Jun 16, 2021

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

image

What is actually happening?

In 3.1.1, only the component watcher got triggered

image

@posva posva added 🐞 bug Something isn't working ❗ p4-important Priority 4: this fixes bugs that violate documented behavior, or significantly improves perf. labels Jun 17, 2021
@posva
Copy link
Member

posva commented Jun 17, 2021

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

@edison1105
Copy link
Member

@shadowings-zy
Copy link
Contributor

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.

@Justineo
Copy link
Member

Justineo commented Jun 17, 2021

IIRC we haven’t planned this breaking change for Vue 3. Maybe we should keep the old behavior?

@yuripave
Copy link
Author

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

@github-actions github-actions bot locked and limited conversation to collaborators Oct 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
❗ p4-important Priority 4: this fixes bugs that violate documented behavior, or significantly improves perf. 🐞 bug Something isn't working
Projects
None yet
5 participants