Skip to content

Commit 1f81286

Browse files
committed
[fixed] Ignore stale transitions
1 parent 5149d77 commit 1f81286

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

modules/utils/createRouter.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -410,11 +410,15 @@ function createRouter(options) {
410410
);
411411

412412
var dispatchHandler = function (error, transition) {
413+
if (error)
414+
onError.call(router, error);
415+
416+
if (pendingTransition !== transition)
417+
return;
418+
413419
pendingTransition = null;
414420

415-
if (error) {
416-
onError.call(router, error);
417-
} else if (transition.isAborted) {
421+
if (transition.isAborted) {
418422
onAbort.call(router, transition.abortReason, location);
419423
} else {
420424
callback.call(router, router, nextState);

0 commit comments

Comments
 (0)