Skip to content

Commit 6271c85

Browse files
committed
Prevent cancel when navigating to same route.
1 parent 892c5d5 commit 6271c85

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/lib/client/superForm.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1792,9 +1792,10 @@ export function superForm<
17921792
cancel
17931793
};
17941794

1795-
// Check for goto in the events
1795+
// Check for goto to a different route in the events
17961796
const unsubCheckforNav = navigating.subscribe(($nav) => {
1797-
if ($nav) cancel();
1797+
if (!$nav || $nav.from?.route.id === $nav.to?.route.id) return;
1798+
cancel();
17981799
});
17991800

18001801
for (const event of formEvents.onResult) {

0 commit comments

Comments
 (0)