#Cannot watch route

7 messages · Page 1 of 1 (latest)

obtuse lark
#

Is route watching working in 3.6+ for you?
I used to watch(route, () => { doSomething() }). In 3.5.3, doSomething() would run anytime I navigate to a different page, in 3.6.2, nothing happens

granite forge
#

Hmm, I can reproduce with those versions. Looks like something changed under the hood but I couldn't tell you what and why. However, to get to some conclusion, what is it you're hoping to observe? Perhaps watching a specific property, e.g. () => route.fullPath which works btw, may give you some closure to your issue?

dull epoch
#

same here everything was working fine untill i updated to 3.6

#

it just for example close the menu when the route changes, so every change should set a ref to false

#

ok i figured it out

#

so instead of doing this

  do something here
}, {deep: true, immediate: true})

you can use it like this

watch(() => route.query, () => isOpen.value = false)
#

weird is not documented nice