From a7dcea141f5d40bbf76f59e7f6e378098e7bd4a7 Mon Sep 17 00:00:00 2001 From: Kendell R Date: Sat, 24 May 2025 16:43:08 -0700 Subject: [PATCH 1/2] attempt to clarify use:enhance docs --- documentation/docs/20-core-concepts/30-form-actions.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/documentation/docs/20-core-concepts/30-form-actions.md b/documentation/docs/20-core-concepts/30-form-actions.md index 86c3b02233a5..8d92ac2179d1 100644 --- a/documentation/docs/20-core-concepts/30-form-actions.md +++ b/documentation/docs/20-core-concepts/30-form-actions.md @@ -368,7 +368,7 @@ Without an argument, `use:enhance` will emulate the browser-native behaviour, ju ### Customising use:enhance -To customise the behaviour, you can provide a `SubmitFunction` that runs immediately before the form is submitted, and (optionally) returns a callback that runs with the `ActionResult`. Note that if you return a callback, the default behavior mentioned above is not triggered. To get it back, call `update`. +To customise the behaviour, you can provide a `SubmitFunction` that runs immediately before the form is submitted, and (optionally) returns a callback that runs with the `ActionResult`. ```svelte
Date: Tue, 3 Jun 2025 16:01:15 -0600 Subject: [PATCH 2/2] Update documentation/docs/20-core-concepts/30-form-actions.md --- documentation/docs/20-core-concepts/30-form-actions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/docs/20-core-concepts/30-form-actions.md b/documentation/docs/20-core-concepts/30-form-actions.md index 8d92ac2179d1..8dc852b985c0 100644 --- a/documentation/docs/20-core-concepts/30-form-actions.md +++ b/documentation/docs/20-core-concepts/30-form-actions.md @@ -390,7 +390,7 @@ To customise the behaviour, you can provide a `SubmitFunction` that runs immedia You can use these functions to show and hide loading UI, and so on. -Note that if you return a callback, the default behavior mentioned above is not triggered. The simplest way to get it back is to call `update`. You can customize it by passing `reset: false` and/or `invalidateAll: false` to `update`, or customize it even more by manually reproducing parts of the `use:enhance` behavior with `applyAction`: +If you return a callback, you override the default post-submission behavior. To get it back, call `update`, which accepts `invalidateAll` and `reset` parameters, or use `applyAction` on the result: ```svelte /// file: src/routes/login/+page.svelte