Skip to content

Commit d665cc9

Browse files
committed
Simplify popstate delta check logic in Router
1 parent 30f0866 commit d665cc9

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

.changeset/stupid-camels-wash.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
"@solidjs/router": patch
3+
---
4+
5+
Fix Router popstate event handling logic
6+
7+
- Simplified delta check logic for history navigation
8+
- Improved reliability of forward navigation detection
9+
- Fixed window.history.forward() navigation handling

src/routers/Router.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export function Router(props: RouterProps): JSX.Element {
3232
},
3333
init: notify => bindEvent(window, "popstate",
3434
notifyIfNotBlocked(notify, delta => {
35-
if (delta && delta < 0) {
35+
if (delta) {
3636
return !beforeLeave.confirm(delta);
3737
} else {
3838
const s = getSource();

0 commit comments

Comments
 (0)