diff --git a/.changeset/stupid-camels-wash.md b/.changeset/stupid-camels-wash.md new file mode 100644 index 000000000..68f082c91 --- /dev/null +++ b/.changeset/stupid-camels-wash.md @@ -0,0 +1,9 @@ +--- +"@solidjs/router": patch +--- + +Fix Router popstate event handling logic + +- Simplified delta check logic for history navigation +- Improved reliability of forward navigation detection +- Fixed window.history.forward() navigation handling \ No newline at end of file diff --git a/src/routers/Router.ts b/src/routers/Router.ts index 7a45fe567..7abc3c08f 100644 --- a/src/routers/Router.ts +++ b/src/routers/Router.ts @@ -32,7 +32,7 @@ export function Router(props: RouterProps): JSX.Element { }, init: notify => bindEvent(window, "popstate", notifyIfNotBlocked(notify, delta => { - if (delta && delta < 0) { + if (delta) { return !beforeLeave.confirm(delta); } else { const s = getSource();