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) {
132132 return
133133 }
134134
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
138141 }
139142
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
143150 }
144151
145152 // construct new route and transition context
146153 var route = new Route ( path , this )
147154 var transition = this . _currentTransition =
148- new RouteTransition ( this , route , previousRoute )
155+ new RouteTransition ( this , route , prevRoute )
149156
150157 if ( ! this . app ) {
151158 // initial render
You can’t perform that action at this time.
0 commit comments