diff --git a/packages/router/src/router.tsx b/packages/router/src/router.tsx index 7c237ccce8da2..34cc542c7b573 100644 --- a/packages/router/src/router.tsx +++ b/packages/router/src/router.tsx @@ -125,21 +125,18 @@ export function useHistory() { ! options.transition ) { performPush(); + return; } await new Promise< void >( ( resolve ) => { const classname = options.transition ?? ''; - if ( classname ) { - document.documentElement.classList.add( classname ); - } + document.documentElement.classList.add( classname ); // @ts-expect-error const transition = document.startViewTransition( () => performPush() ); transition.finished.finally( () => { - if ( classname ) { - document.documentElement.classList.remove( classname ); - } + document.documentElement.classList.remove( classname ); resolve(); } ); } );