@@ -30,10 +30,10 @@ export default class BrowserRouter extends Router {
30
30
Router : BrowserRouter
31
31
} ;
32
32
}
33
- async navigate ( path , state = { } , ctx = new Context ( ) ) {
33
+ async navigate ( path , state = { } , ctx = new Context ( ) , force = false ) {
34
34
const currentPath = window . location . pathname + window . location . search ;
35
35
36
- if ( path !== currentPath ) {
36
+ if ( force || path !== currentPath ) {
37
37
// if (this.router.isRunning) this.router.cancel(false);
38
38
const { redirect, error } = await this . router . resolve ( { path, state, ctx } ) ;
39
39
if ( ! ( error && error . message === 'Cancelled' ) ) {
@@ -46,14 +46,14 @@ export default class BrowserRouter extends Router {
46
46
}
47
47
}
48
48
}
49
- async push ( path , state = { } , ctx = new Context ( ) ) {
49
+ async push ( path , state = { } , ctx = new Context ( ) , force = false ) {
50
50
// console.warn('Please use navigate method instead of push, it will be deprecated in future');
51
51
if ( typeof path === 'string' ) {
52
- await this . navigate ( path , state , ctx ) ;
52
+ await this . navigate ( path , state , ctx , force ) ;
53
53
} else {
54
54
let fullPath = path . pathname ;
55
55
if ( path . query ) fullPath += `?${ stringifyQuery ( path . query ) } ` ;
56
- await this . navigate ( fullPath , state , ctx ) ;
56
+ await this . navigate ( fullPath , state , ctx , force ) ;
57
57
}
58
58
}
59
59
// TODO: maybe we need to make this history methods works through navigate?
0 commit comments