You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When routing from /posts/2 to /posts, why is watch() in [id].vue triggered and newId will be undefined? [id].vue seems to trigger watch() again before it is destroyed. Is this the expected behavior?
related discussion: stackoverflow
main problem: why does the watch() trigger when a user has navigated away from [id].vue?
Thank you for your help!
The text was updated successfully, but these errors were encountered:
This is relative to the router but in I couldn't reproduce it. It was a problem in the past and it got fixed so maybe you are using an outdated version?
/users/c to / will not trigger watch(), /users/c to /users triggers watch(). It seems that watch() is triggered again before the component instance is destroyed, which seems to behave the same as the reuse component instance of /users/c to /users/b.
Explicitly defining routes does present the same problem. I think I will raise this problem again at vuejs/router, thank you for your help!!
It's worth trying to reproduce it using only Vue. In the issue I mentioned I added reproductions with Vue. Maybe adding a nested component reproduces the problem
Please forgive me if I put the question in the wrong place.
Based on the following routing structure:
App.vue
:pages/posts.vue
:pages/posts/index.vue
:pages/posts/[id].vue
:When routing from
/posts/2
to/posts
, why iswatch()
in[id].vue
triggered andnewId
will beundefined
?[id].vue
seems to triggerwatch()
again before it is destroyed. Is this the expected behavior?related discussion: stackoverflow
main problem: why does the
watch()
trigger when a user has navigated away from[id].vue
?Thank you for your help!
The text was updated successfully, but these errors were encountered: