@@ -15,7 +15,8 @@ import {
15
15
createNavigationDuplicatedError ,
16
16
createNavigationCancelledError ,
17
17
createNavigationRedirectedError ,
18
- createNavigationAbortedError
18
+ createNavigationAbortedError ,
19
+ NavigationFailureType
19
20
} from './errors'
20
21
21
22
export class History {
@@ -33,8 +34,8 @@ export class History {
33
34
34
35
// implemented by sub-classes
35
36
+ go : ( n : number ) = > void
36
- + push : ( loc : RawLocation ) = > void
37
- + replace : ( loc : RawLocation ) = > void
37
+ + push : ( loc : RawLocation , onComplete ? : Function , onAbort ? : Function ) = > void
38
+ + replace : ( loc : RawLocation , onComplete ? : Function , onAbort ? : Function ) = > void
38
39
+ ensureURL : ( push ? : boolean ) = > void
39
40
+ getCurrentLocation : ( ) = > string
40
41
+ setupListeners : Function
@@ -102,9 +103,17 @@ export class History {
102
103
}
103
104
if ( err && ! this . ready ) {
104
105
this . ready = true
105
- this . readyErrorCbs . forEach ( cb => {
106
- cb ( err )
107
- } )
106
+ // Initial redirection should still trigger the onReady onSuccess
107
+ // https://github.com/vuejs/vue-router/issues/3225
108
+ if ( ! isRouterError ( err , NavigationFailureType . redirected ) ) {
109
+ this . readyErrorCbs . forEach ( cb => {
110
+ cb ( err )
111
+ } )
112
+ } else {
113
+ this . readyCbs . forEach ( cb => {
114
+ cb ( route )
115
+ } )
116
+ }
108
117
}
109
118
}
110
119
)
0 commit comments