@@ -124,11 +124,6 @@ export default function (Vue, Router) {
124
124
let prevRoute = this . _currentRoute
125
125
let prevTransition = this . _currentTransition
126
126
127
- // abort ongoing transition
128
- if ( prevTransition && path !== prevTransition . to . path ) {
129
- prevTransition . aborted = true
130
- }
131
-
132
127
// do nothing if going to the same route.
133
128
// the route only changes when a transition successfully
134
129
// reaches activation; we don't need to do anything
@@ -140,8 +135,9 @@ export default function (Vue, Router) {
140
135
141
136
// construct new route and transition context
142
137
let route = new Route ( path , this )
143
- let transition = this . _currentTransition =
144
- new RouteTransition ( this , route , prevRoute )
138
+ let transition = new RouteTransition ( this , route , prevRoute )
139
+ this . _prevTransition = prevTransition
140
+ this . _currentTransition = transition
145
141
146
142
if ( ! this . app ) {
147
143
// initial render
@@ -175,15 +171,22 @@ export default function (Vue, Router) {
175
171
}
176
172
177
173
/**
178
- * Switch the current route to a new one .
174
+ * Set current to the new transition .
179
175
* This is called by the transition object when the
180
176
* validation of a route has succeeded.
181
177
*
182
- * @param {Route } route
178
+ * @param {RouteTransition } transition
183
179
*/
184
180
185
- Router . prototype . _updateRoute = function ( route ) {
186
- this . _currentRoute = route
181
+ Router . prototype . _onTransitionValidated = function ( transition ) {
182
+ // now that this one is validated, we can abort
183
+ // the previous transition.
184
+ let prevTransition = this . _prevTransition
185
+ if ( prevTransition ) {
186
+ prevTransition . aborted = true
187
+ }
188
+ // set current route
189
+ let route = this . _currentRoute = transition . to
187
190
// update route context for all children
188
191
if ( this . app . $route !== route ) {
189
192
this . app . $route = route
0 commit comments