fix(admin): preserve form values after save in user and group edit

SvelteKit's default `use:enhance` behaviour calls `form.reset()` after
a successful non-redirecting action, which wipes inputs that use
`value={...}` (property set, not defaultValue). The edit forms now
pass `reset: false` to `update()` so the saved values stay visible
after the success banner appears.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-04-21 12:07:50 +02:00
parent 4ec0b9d6c8
commit 3744a6ba3c
2 changed files with 8 additions and 2 deletions

View File

@@ -94,7 +94,10 @@ const ADMIN_PERMISSIONS = $derived([
id="edit-group-form"
method="POST"
action="?/update"
use:enhance
use:enhance={() =>
async ({ update }) => {
await update({ reset: false });
}}
oninput={unsaved.markDirty}
>
<!-- Group name card -->

View File

@@ -85,7 +85,10 @@ $effect(() => {
id="edit-user-form"
method="POST"
action="?/update"
use:enhance
use:enhance={() =>
async ({ update }) => {
await update({ reset: false });
}}
oninput={unsaved.markDirty}
class="space-y-5"
>