diff --git a/.changeset/nervous-students-march.md b/.changeset/nervous-students-march.md new file mode 100644 index 000000000000..c79099c5944c --- /dev/null +++ b/.changeset/nervous-students-march.md @@ -0,0 +1,6 @@ +--- +'create-svelte': patch +'@sveltejs/kit': patch +--- + +[feat] add reset option to update method of enhance diff --git a/documentation/docs/06-form-actions.md b/documentation/docs/06-form-actions.md index 401e09f14ca3..05dcde8467e3 100644 --- a/documentation/docs/06-form-actions.md +++ b/documentation/docs/06-form-actions.md @@ -250,7 +250,7 @@ The easiest way to progressively enhance a form is to add the `use:enhance` acti Without an argument, `use:enhance` will emulate the browser-native behaviour, just without the full-page reloads. It will: - update the `form` property, `$page.form` and `$page.status` on a successful or invalid response, but only if the action is on the same page you're submitting from. So for example if your form looks like `
`, `form` and `$page` will _not_ be updated. This is because in the native form submission case you would be redirected to the page the action is on. -- invalidate all data using `invalidateAll` on a successful response +- reset the `` element and invalidate all data using `invalidateAll` on a successful response - call `goto` on a redirect response - render the nearest `+error` boundary if an error occurs diff --git a/packages/create-svelte/templates/default/src/routes/sverdle/+page.svelte b/packages/create-svelte/templates/default/src/routes/sverdle/+page.svelte index 6f3352278dea..894afab18ff7 100644 --- a/packages/create-svelte/templates/default/src/routes/sverdle/+page.svelte +++ b/packages/create-svelte/templates/default/src/routes/sverdle/+page.svelte @@ -1,8 +1,7 @@