From d665cc98cf4512198aea3c8db06c0583a3fa437f Mon Sep 17 00:00:00 2001 From: dennev <221695162+dennev@users.noreply.github.com> Date: Sun, 10 Aug 2025 10:41:07 +0900 Subject: [PATCH] Simplify popstate delta check logic in Router --- .changeset/stupid-camels-wash.md | 9 +++++++++ src/routers/Router.ts | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 .changeset/stupid-camels-wash.md 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();