Skip to content

Commit

Permalink
Actually prevent transition
Browse files Browse the repository at this point in the history
  • Loading branch information
tyxla committed Nov 28, 2024
1 parent 4928a5e commit bb9b71f
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions packages/router/src/router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
} );
} );
Expand Down

0 comments on commit bb9b71f

Please sign in to comment.