-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
this
is undefined in beforeRouteLeave hook in some cases
#1288
Comments
Hi, thanks for filling this issue. Please follow the Issue Reporting Guidelines and provide a live reproduction on jsfiddle, codepen etc. Thanks! |
Unfortunately, I am not able to reproduce it on demand on my own environment.. |
Ok, if you ever manage to reproduce it, make sure to open a new issue 🙂 |
Hey, this issue can be reproduced. |
I managed to reproduce it as well, but only on my own environment. I am not able to create a runnable reproduction link (JSFiddle / JSBin / CodePen) at this point. |
If you manage to boil it down to the strict minimum on a repository, we can also look at that |
Look at this JSFiddle.
|
It looks like it fixed in 2.5.2 version of vue-router. Thanks |
@pastdevr thanks.the latest version certainly fixed that bug |
Vue.js / vue-router versions
2.1.10 / 2.1.3
Steps
I detect the session is expired in a global HTTP interceptor:
Vue.http.interceptors.push((request, next) => {...})
I attempt to redirect the user so that he/she can authenticate:
router.push({...})
The
beforeRouteLeave
hook of a component is triggeredWhat is Expected?
this
is definedWhat is actually happening?
this
is undefinedThis seems to happen only locally, after my machine wakes up from sleep, while the Node.js server is still running, and after I make some changes to the code (with webpack hot reload enabled).
The text was updated successfully, but these errors were encountered: