diff --git a/frontend/src/routes/admin/tags/[id]/+page.svelte b/frontend/src/routes/admin/tags/[id]/+page.svelte index 0bed5324..ad14951c 100644 --- a/frontend/src/routes/admin/tags/[id]/+page.svelte +++ b/frontend/src/routes/admin/tags/[id]/+page.svelte @@ -21,6 +21,16 @@ function getInitialColor() { let parentId = $state(getInitialParentId()); let selectedColor = $state(getInitialColor()); +// SvelteKit reuses the same component instance when navigating between tags client-side. +// $state() only initialises on mount, so we need an effect to reset local form state +// whenever the server switches to a different tag. +$effect(() => { + void data.tag.id; // declare dependency + parentId = data.tag.parentId ?? ''; + selectedColor = data.tag.color ?? ''; + deleteConfirmName = ''; +}); + const colors = [ 'sage', 'sienna',