Skip to content

Commit a7dcea1

Browse files
authored
attempt to clarify use:enhance docs
1 parent b45cd46 commit a7dcea1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

documentation/docs/20-core-concepts/30-form-actions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ Without an argument, `use:enhance` will emulate the browser-native behaviour, ju
368368
369369
### Customising use:enhance
370370
371-
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`.
371+
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`.
372372
373373
```svelte
374374
<form
@@ -390,7 +390,7 @@ To customise the behaviour, you can provide a `SubmitFunction` that runs immedia
390390
391391
You can use these functions to show and hide loading UI, and so on.
392392
393-
If you return a callback, you may need to reproduce part of the default `use:enhance` behaviour, but without invalidating all data on a successful response. You can do so with `applyAction`:
393+
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`:
394394
395395
```svelte
396396
/// file: src/routes/login/+page.svelte

0 commit comments

Comments
 (0)