@@ -195,8 +195,8 @@ export function useMatch<
195195 * The interface for the `navigate` function returned from {@link useNavigate}.
196196 */
197197export interface NavigateFunction {
198- ( to : To , options ?: NavigateOptions ) : void | Promise < void > ;
199- ( delta : number ) : void | Promise < void > ;
198+ ( to : To , options ?: NavigateOptions ) : Promise < void > ;
199+ ( delta : number ) : Promise < void > ;
200200}
201201
202202const navigateEffectWarning =
@@ -355,11 +355,11 @@ function useNavigateUnstable(): NavigateFunction {
355355
356356 // Short circuit here since if this happens on first render the navigate
357357 // is useless because we haven't wired up our history listener yet
358- if ( ! activeRef . current ) return ;
358+ if ( ! activeRef . current ) return Promise . resolve ( ) ;
359359
360360 if ( typeof to === "number" ) {
361361 navigator . go ( to ) ;
362- return ;
362+ return Promise . resolve ( ) ;
363363 }
364364
365365 let path = resolveTo (
@@ -387,6 +387,8 @@ function useNavigateUnstable(): NavigateFunction {
387387 options . state ,
388388 options ,
389389 ) ;
390+
391+ return Promise . resolve ( ) ;
390392 } ,
391393 [
392394 basename ,
@@ -1757,9 +1759,9 @@ function useNavigateStable(): NavigateFunction {
17571759 if ( ! activeRef . current ) return ;
17581760
17591761 if ( typeof to === "number" ) {
1760- router . navigate ( to ) ;
1762+ return router . navigate ( to ) ;
17611763 } else {
1762- await router . navigate ( to , { fromRouteId : id , ...options } ) ;
1764+ return router . navigate ( to , { fromRouteId : id , ...options } ) ;
17631765 }
17641766 } ,
17651767 [ router , id ] ,
0 commit comments