Description
The taintedMessage beforeNavigate hook can cause the goto function to throw if the user is navigating to an external link. This is a minor bug all things considered because it does not break anything for the user. Just causes noise in error tracking platforms like Sentry.
Relevant Code
|
try { |
|
Tainted.forceRedirection = true; |
|
//@ts-expect-error Possible SvelteKit breaking change, it worked before. |
|
await goto(nav.to.url, { ...nav.to.params }); |
|
return; |
|
} finally { |
MRE
<script lang="ts">
import { superForm } from 'sveltekit-superforms';
let { data } = $props();
const { form, enhance } = superForm(data.form, {
taintedMessage: 'You will lose all of your changes',
});
</script>
<form method="POST" use:enhance style="display: flex; flex-direction: column; gap: 1rem">
<label>
Name
<input name="name" bind:value={$form.name} />
</label>
<p>
<a href="https://www.github.com" style="color: blue; text-decoration: underline;">
Click me after editing the form to trigger the error
</a>
</p>
</form>
Description
The
taintedMessagebeforeNavigate hook can cause thegotofunction to throw if the user is navigating to an external link. This is a minor bug all things considered because it does not break anything for the user. Just causes noise in error tracking platforms like Sentry.Relevant Code
sveltekit-superforms/src/lib/client/superForm.ts
Lines 1254 to 1259 in b54f69f
MRE