While using the svelte-forms in sveltekit I am getting the following runtime error even calling the function inside the onMount
funtion called outside component initialisation
This can be solved by providing validateOnChange option in form function.
<script>
import { onMount, afterUpdate } from 'svelte';
import { form } from 'svelte-forms';
let myForm;
onMount(() => {
myForm = form(() => ({}), {
validateOnChange: false
});
});
afterUpdate(() => {
myForm.validate();
});
</script>