@@ -51,7 +51,6 @@ export class History {
51
51
activated
52
52
} = resolveQueue ( this . current . matched , route . matched )
53
53
54
- const postEnterCbs = [ ]
55
54
const queue = [ ] . concat (
56
55
// in-component leave guards
57
56
extractLeaveGuards ( deactivated ) ,
@@ -60,27 +59,27 @@ export class History {
60
59
// enter guards
61
60
activated . map ( m => m . beforeEnter ) ,
62
61
// async components
63
- resolveAsyncComponents ( activated ) ,
64
- // in-component enter guards
65
- extractEnterGuards ( activated , postEnterCbs )
66
- ) . filter ( _ => _ )
62
+ resolveAsyncComponents ( activated )
63
+ )
67
64
68
65
this . pending = route
69
66
const redirect = location => this . push ( location )
67
+ const iterator = ( hook , next ) => hook ( route , redirect , next )
70
68
71
- runQueue (
72
- queue ,
73
- ( hook , next ) => { hook ( route , redirect , next ) } ,
74
- ( ) => {
69
+ runQueue ( queue , iterator , ( ) => {
70
+ const postEnterCbs = [ ]
71
+ // wait until async components are resolved before
72
+ // extracting in-component enter guards
73
+ runQueue ( extractEnterGuards ( activated , postEnterCbs ) , iterator , ( ) => {
75
74
if ( isSameRoute ( route , this . pending ) ) {
76
75
this . pending = null
77
76
cb ( route )
78
77
this . router . app . $nextTick ( ( ) => {
79
78
postEnterCbs . forEach ( cb => cb ( ) )
80
79
} )
81
80
}
82
- }
83
- )
81
+ } )
82
+ } )
84
83
}
85
84
86
85
updateRoute ( route : Route ) {
0 commit comments