Skip to content

Commit a5a2a88

Browse files
committed
chore: remove transition error race when using back or forward browser buttons
1 parent 0674d04 commit a5a2a88

File tree

1 file changed

+3
-3
lines changed
  • packages/router/src/navigation-api

1 file changed

+3
-3
lines changed

packages/router/src/navigation-api/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,7 @@ export function createNavigationApiRouter(
774774
async function handleNavigate(event: NavigateEvent) {
775775
clearTimeout(focusTimeoutId)
776776

777-
if (!event.canIntercept) {
777+
if (!event.canIntercept || event.navigationType === 'traverse') {
778778
return
779779
}
780780

@@ -785,7 +785,7 @@ export function createNavigationApiRouter(
785785
// the back and forward buttons cannot be detected properly since the currentEntry
786786
// is already updated when the handler is executed.
787787
let navigationInfo: NavigationInformation | undefined
788-
if (event.navigationType === 'traverse') {
788+
/*if (event.navigationType === 'traverse') {
789789
const fromIndex = window.navigation.currentEntry?.index ?? -1
790790
const toIndex = event.destination.index
791791
const delta = fromIndex === -1 ? 0 : toIndex - fromIndex
@@ -799,7 +799,7 @@ export function createNavigationApiRouter(
799799
isForwardBrowserButton: delta > 0,
800800
navigationApiEvent: event,
801801
}
802-
} else if (
802+
} else */ if (
803803
event.navigationType === 'push' ||
804804
event.navigationType === 'replace'
805805
) {

0 commit comments

Comments
 (0)