Skip to content
Discussion options

You must be logged in to vote

You can create your own enhance method (i copied the code from sveltekits enhance method):

import { applyAction, enhance } from '$app/forms';
import { invalidateAll } from '$app/navigation';
import { writable } from 'svelte/store';

const { set, subscribe } = writable(false);

export const formLoading = { subscribe };

export function enhanceWithLoad(form: HTMLFormElement) {
	return enhance(form, () => {
		set(true);
		return async ({ result, action }) => {
			if (result.type === 'success') {
				await invalidateAll();
			}

			// For success/invalid results, only apply action if it belongs to the
			// current page, otherwise `form` will be updated erroneously
			if (
				location.origin + 

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@fehnomenal
Comment options

Answer selected by exseniorastronaut
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants