@@ -51,7 +51,6 @@ export class History {
5151 activated
5252 } = resolveQueue ( this . current . matched , route . matched )
5353
54- const postEnterCbs = [ ]
5554 const queue = [ ] . concat (
5655 // in-component leave guards
5756 extractLeaveGuards ( deactivated ) ,
@@ -60,27 +59,27 @@ export class History {
6059 // enter guards
6160 activated . map ( m => m . beforeEnter ) ,
6261 // async components
63- resolveAsyncComponents ( activated ) ,
64- // in-component enter guards
65- extractEnterGuards ( activated , postEnterCbs )
66- ) . filter ( _ => _ )
62+ resolveAsyncComponents ( activated )
63+ )
6764
6865 this . pending = route
6966 const redirect = location => this . push ( location )
67+ const iterator = ( hook , next ) => hook ( route , redirect , next )
7068
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 , ( ) => {
7574 if ( isSameRoute ( route , this . pending ) ) {
7675 this . pending = null
7776 cb ( route )
7877 this . router . app . $nextTick ( ( ) => {
7978 postEnterCbs . forEach ( cb => cb ( ) )
8079 } )
8180 }
82- }
83- )
81+ } )
82+ } )
8483 }
8584
8685 updateRoute ( route : Route ) {
0 commit comments