2.1.10 / 2.1.3
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 triggered
this is defined
this is undefined

This 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).
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.
For example, I have two routes _/one_, _/two_ with same component. When I go from _/one_ to _/two_ this is defined in beforeRouteLeave hook. Then when I go from _/two_ to some other route I have this is undefined.
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.
Steps to reproduce error:
Click /home (beforeRouteLeave is not invoked, ok)
Click _/foo_ (this in beforeRouteLeave is defined, ok)
Click _/bar_ (this in beforeRouteLeave is not defined, bad)
It looks like it fixed in 2.5.2 version of vue-router. Thanks
@pastdevr thanks.the latest version certainly fixed that bug
Most helpful comment
Hey, this issue can be reproduced.
For example, I have two routes _/one_, _/two_ with same component. When I go from _/one_ to _/two_
thisis defined inbeforeRouteLeavehook. Then when I go from _/two_ to some other route I havethisis undefined.