diff --git a/.changeset/hot-pugs-worry.md b/.changeset/hot-pugs-worry.md new file mode 100644 index 0000000..5e776a3 --- /dev/null +++ b/.changeset/hot-pugs-worry.md @@ -0,0 +1,5 @@ +--- +'sv-router': patch +--- + +correctly handle cancellation of navigations diff --git a/src/create-router.svelte.js b/src/create-router.svelte.js index e1c4f91..f3e2c52 100644 --- a/src/create-router.svelte.js +++ b/src/create-router.svelte.js @@ -178,7 +178,7 @@ export async function onNavigate(path, options = {}) { } if ( navigationIndex !== currentNavigationIndex || - (fromBeforeLoadHook && pendingNavigationIndex + 1 !== currentNavigationIndex) + (fromBeforeLoadHook && pendingNavigationIndex !== currentNavigationIndex) ) { return; }