File tree Expand file tree Collapse file tree 1 file changed +14
-7
lines changed Expand file tree Collapse file tree 1 file changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -132,20 +132,27 @@ module.exports = function (Vue, Router) {
132
132
return
133
133
}
134
134
135
- var previousRoute = this . _currentRoute
136
- if ( this . app && path === previousRoute . path ) {
137
- return
135
+ var prevRoute = this . _currentRoute
136
+ var prevTransition = this . _currentTransition
137
+
138
+ // abort ongoing transition
139
+ if ( prevTransition && path !== prevTransition . to . path ) {
140
+ prevTransition . aborted = true
138
141
}
139
142
140
- // abort previous transition
141
- if ( this . _currentTransition ) {
142
- this . _currentTransition . aborted = true
143
+ // do nothing if going to the same route.
144
+ // the route only changes when a transition successfully
145
+ // reaches activation; we don't need to do anything
146
+ // if an ongoing transition is aborted during validation
147
+ // phase.
148
+ if ( prevTransition && path === prevRoute . path ) {
149
+ return
143
150
}
144
151
145
152
// construct new route and transition context
146
153
var route = new Route ( path , this )
147
154
var transition = this . _currentTransition =
148
- new RouteTransition ( this , route , previousRoute )
155
+ new RouteTransition ( this , route , prevRoute )
149
156
150
157
if ( ! this . app ) {
151
158
// initial render
You can’t perform that action at this time.
0 commit comments