@@ -52,7 +52,7 @@ export default class BrowserDriver extends EventEmitter<IDriverEventMap> impleme
52
52
}
53
53
public push ( path : string , state ?: unknown , payload ?: unknown ) : void {
54
54
const id = this . nextId || IdGenerator . generateId ( ) ;
55
- this . deprecateNextId ( ) ;
55
+ if ( this . nextId ) this . deprecateNextId ( ) ;
56
56
window . history . pushState ( { __routeState : { id, state } } as IHistoryRouteState , '' , this . getUrl ( path ) ) ;
57
57
this . handleRouteChange ( RouteActionType . PUSH , id , path , state , payload ) ;
58
58
}
@@ -67,7 +67,7 @@ export default class BrowserDriver extends EventEmitter<IDriverEventMap> impleme
67
67
68
68
public replace ( path : string , state ?: unknown , payload ?: unknown ) : void {
69
69
const id = this . nextId || IdGenerator . generateId ( ) ;
70
- this . deprecateNextId ( ) ;
70
+ if ( this . nextId ) this . deprecateNextId ( ) ;
71
71
window . history . replaceState ( { __routeState : { id, state } } as IHistoryRouteState , '' , this . getUrl ( path ) ) ;
72
72
this . handleRouteChange ( RouteActionType . REPLACE , id , path , state , payload ) ;
73
73
}
@@ -100,7 +100,7 @@ export default class BrowserDriver extends EventEmitter<IDriverEventMap> impleme
100
100
} ) ;
101
101
}
102
102
private handlePopstate ( e : PopStateEvent ) {
103
- this . deprecateNextId ( ) ;
103
+ if ( this . nextId ) this . deprecateNextId ( ) ;
104
104
const historyState = e . state as IHistoryRouteState | null ;
105
105
const routeState = historyState && historyState . __routeState ;
106
106
if ( routeState ) {
@@ -119,7 +119,7 @@ export default class BrowserDriver extends EventEmitter<IDriverEventMap> impleme
119
119
}
120
120
121
121
private getInitRouteRecord ( ) : IRouteRecord {
122
- const path = this . getCurrentPath ( ) || '/' ;
122
+ const path = this . getCurrentPath ( ) ;
123
123
let id : string ;
124
124
let state : unknown ;
125
125
const currentState = window . history . state as IHistoryRouteState ;
0 commit comments