vuejs / router

🚦 The official router for Vue.js
https://router.vuejs.org/
MIT License
3.75k stars 1.15k forks source link

problem in watch query of route #2142

Closed mohamadkhalili closed 4 months ago

mohamadkhalili commented 4 months ago

Reproduction

https://codesandbox.io/p/sandbox/gifted-danny-dhw9wh?file=%2Fsrc%2FApp.vue%3A22%2C7-22%2C12

Steps to reproduce the bug

1- click on "names query 1" 2- check logs 3- click on "names query 2" 4- check logs

Expected behavior

I expected that no log would be displayed after clicking on "names query 2".

Actual behavior

In fact, it seems that the entire query element is watched, not the names element itself

Additional information

No response

posva commented 4 months ago

You repro link is broken but this is likely just how watchers work. FYI: each navigation generates a new route objecy

mohamadkhalili commented 4 months ago

new issue with new repo created

2143