Skip to content

Commit 2f0fd87

Browse files
sbesh91claude
andcommitted
fix: Gate navigation intercept on canIntercept check
Move canIntercept to the top of the guard conditions so navigations that cannot be intercepted (e.g. back/forward to history.replaceState entries) are skipped cleanly without calling e.intercept(). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 89941d4 commit 2f0fd87

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/router.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ function handleNav(state, e) {
4343
const url = new URL(e.destination.url);
4444

4545
if (
46+
!e.canIntercept ||
4647
e.hashChange ||
4748
e.downloadRequest !== null ||
4849
!isSameWindow(e) ||
@@ -54,8 +55,7 @@ function handleNav(state, e) {
5455
return state;
5556
}
5657

57-
//if (e.canIntercept)
58-
e.intercept();
58+
e.intercept();
5959
return url.href.replace(url.origin, '');
6060
}
6161

0 commit comments

Comments
 (0)