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
watcher for a route param is called when a user leaved the route #2291
Comments
This is a regression of #1603 |
As a workaround, use a post flush watcher: watch: {
"$route.params.fooId": {
handler: "fetch",
flush: "post"
}
} |
Are there any plans to fix this issue? The workaround works okay for your own watchers, but I'm running into this with watchers in external libraries as well, in which case I can't affect how they flush. |
Looks like this still isn't fixed, am I right? Any plans to fix this? |
@yyx990803 Does |
Looks like Vue 2.7 has the same issue |
Version
3.0.0
Reproduction link
https://jsfiddle.net/posva/yvegmca7/
SFC (no vue router)
Steps to reproduce
foo1
link in result tabbar
link in result tab"fetch foo: ", undefined
will be shown in consolesame code with Vue v2.x do not show
"fetch foo: ", undefined
.https://jsfiddle.net/s74dutkm/1/
What is expected?
watcher for a route param is not called when a user leaved the route (same as v2)
What is actually happening?
watcher for a route param is called when a user leaved the route (watcher gets
undefined
as the route param)it may be caused by this breaking change.
I don't think it's natural that we need to consider the possibility a route param is
undefined
in a route which requires the param.The text was updated successfully, but these errors were encountered: