Skip to content

Commit d732d56

Browse files
fix: introduce the missing navigation cancellation fix
1 parent c5bf70e commit d732d56

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

.changeset/hot-pugs-worry.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
'sv-router': patch
33
---
44

5-
pass initial page pathname, search, hash to onNavigate, correctly handle cancellation of navigations, return Error in navigate
5+
correctly handle cancellation of navigations, return Error in navigate

src/create-router.svelte.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { BROWSER, DEV } from 'esm-env';
22
import { isActive } from './helpers/is-active.js';
33
import { matchRoute } from './helpers/match-route.js';
44
import { preload, preloadOnHover } from './helpers/preload.js';
5-
import { Navigation } from './navigation.js';
65
import {
76
constructPath,
87
constructUrl,
@@ -135,7 +134,7 @@ function navigate(path, options = {}) {
135134
}
136135

137136
/**
138-
* @param {string} path
137+
* @param {string} [path]
139138
* @param {import('./index.d.ts').NavigateOptions} options
140139
*/
141140
export async function onNavigate(path, options = {}) {
@@ -180,7 +179,7 @@ export async function onNavigate(path, options = {}) {
180179
}
181180
if (
182181
navigationIndex !== currentNavigationIndex ||
183-
(fromBeforeLoadHook && pendingNavigationIndex + 1 !== currentNavigationIndex)
182+
(fromBeforeLoadHook && pendingNavigationIndex !== currentNavigationIndex)
184183
) {
185184
return;
186185
}

0 commit comments

Comments
 (0)