@@ -30,10 +30,10 @@ export default class BrowserRouter extends Router {
3030 Router : BrowserRouter
3131 } ;
3232 }
33- async navigate ( path , state = { } , ctx = new Context ( ) ) {
33+ async navigate ( path , state = { } , ctx = new Context ( ) , force = false ) {
3434 const currentPath = window . location . pathname + window . location . search ;
3535
36- if ( path !== currentPath ) {
36+ if ( force || path !== currentPath ) {
3737 // if (this.router.isRunning) this.router.cancel(false);
3838 const { redirect, error } = await this . router . resolve ( { path, state, ctx } ) ;
3939 if ( ! ( error && error . message === 'Cancelled' ) ) {
@@ -46,14 +46,14 @@ export default class BrowserRouter extends Router {
4646 }
4747 }
4848 }
49- async push ( path , state = { } , ctx = new Context ( ) ) {
49+ async push ( path , state = { } , ctx = new Context ( ) , force = false ) {
5050 // console.warn('Please use navigate method instead of push, it will be deprecated in future');
5151 if ( typeof path === 'string' ) {
52- await this . navigate ( path , state , ctx ) ;
52+ await this . navigate ( path , state , ctx , force ) ;
5353 } else {
5454 let fullPath = path . pathname ;
5555 if ( path . query ) fullPath += `?${ stringifyQuery ( path . query ) } ` ;
56- await this . navigate ( fullPath , state , ctx ) ;
56+ await this . navigate ( fullPath , state , ctx , force ) ;
5757 }
5858 }
5959 // TODO: maybe we need to make this history methods works through navigate?
0 commit comments