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
Mixin guard: beforeRouteUpdate should be triggered.
What is actually happening?
Mixin guard is not triggered
I initially wanted to file an issue because the beforeRouteEnter guard showed this behaviour, but I wasn't able to reproduce it within a jsfiddle. I'm quite sure that the bug affects also the other guard.
changed the title [-]Guards are not merged when using mixins[/-][+]Guards are merged instead of called after each other when using mixins[/+]on Jun 19, 2017
changed the title [-]Guards are merged instead of called after each other when using mixins[/-][+]Mixin guard is not called when component has same guard[/+]on Jun 19, 2017
After some more debugging, I think that the other problem (beforeRouteEnter) has to do with a difference in lifecycle hook call order. What I'im unable to see is, why there is a difference in the first place...
Jsfiddle hook call order (on full reload) - works:
It looks like we forgot to add the merge strategy. For the moment, adding Vue.config.optionMergeStrategies.beforeRouteUpdate = Vue.config.optionMergeStrategies.beforeRouteEnter to your code should solve the issue
Are you using the latest versions on your project?
@posva
The second problem I mentioned seems to persist in vue-router@2.6, however there seems to be an improvement: Only the first time the route is loaded, the mixin hooks seems to fail being called, every navigation afterwards to this route calls both hooks.
I'm still trying to reproduce the error in a fiddle, but maybe that helps you pinpointing the problem in the meantime.
Activity
[-]Guards are not merged when using mixins[/-][+]Guards are merged instead of called after each other when using mixins[/+][-]Guards are merged instead of called after each other when using mixins[/-][+]Mixin guard is not called when component has same guard[/+]nirazul commentedon Jun 19, 2017
After some more debugging, I think that the other problem (
beforeRouteEnter
) has to do with a difference in lifecycle hook call order. What I'im unable to see is, why there is a difference in the first place...Jsfiddle hook call order (on full reload) - works:
Hook call order in my app (on full reload) - fails:
posva commentedon Jun 19, 2017
It looks like we forgot to add the merge strategy. For the moment, adding
Vue.config.optionMergeStrategies.beforeRouteUpdate = Vue.config.optionMergeStrategies.beforeRouteEnter
to your code should solve the issueAre you using the latest versions on your project?
Add beforeRouteUpdate merge strategy
nirazul commentedon Jun 19, 2017
@posva I'm using vue-router 2.5.3 in my app. I will check if the problem with
beforeRouteEnter
persists in 2.6...nirazul commentedon Jun 26, 2017
@posva
The second problem I mentioned seems to persist in vue-router@2.6, however there seems to be an improvement: Only the first time the route is loaded, the mixin hooks seems to fail being called, every navigation afterwards to this route calls both hooks.
I'm still trying to reproduce the error in a fiddle, but maybe that helps you pinpointing the problem in the meantime.
nirazul commentedon Jun 26, 2017
I've found the issue to my second problem. I'm opening a second report for it.
Add beforeRouteUpdate merge strategy (#1521)