Skip to content

Commit 7ac1b2a

Browse files
webJoseCopilot
andauthored
feat: Move calling order around to enable navigation cancellation
Co-authored-by: Copilot <[email protected]>
1 parent 67667b4 commit 7ac1b2a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/lib/Link/Link.svelte

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,11 @@
103103
);
104104
105105
function handleClick(event: MouseEvent & { currentTarget: EventTarget & HTMLAnchorElement }) {
106+
incomingOnclick?.(event);
107+
if (event.defaultPrevented) return;
106108
event.preventDefault();
107109
const newState = calculateState(resolvedHash, typeof state === 'function' ? state() : state);
108110
location.goTo(calcHref, { state: newState, replace: calcReplace });
109-
incomingOnclick?.(event);
110111
}
111112
112113
function styleString() {

0 commit comments

Comments
 (0)