Prevent invalidate while using enhance action #10702
Answered
by
eltigerchino
PhanDungTri
asked this question in
Q&A
-
How can I instruct Svelte NOT to invalidate the page data after the form submission? So that the |
Beta Was this translation helpful? Give feedback.
Answered by
eltigerchino
Sep 11, 2023
Replies: 1 comment
-
https://kit.svelte.dev/docs/form-actions#progressive-enhancement-use-enhance
<form
method="POST"
use:enhance={({ formElement, formData, action, cancel, submitter }) => {
// `formElement` is this `<form>` element
// `formData` is its `FormData` object that's about to be submitted
// `action` is the URL to which the form is posted
// calling `cancel()` will prevent the submission
// `submitter` is the `HTMLElement` that caused the form to be submitted
return async ({ result, update }) => {
// `result` is an `ActionResult` object
// `update` is a function which triggers the default logic that would be triggered if this callback wasn't set
};
}}
> |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
PhanDungTri
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://kit.svelte.dev/docs/form-actions#progressive-enhancement-use-enhance