diff --git a/frontend/src/lib/components/PersonTypeahead.svelte b/frontend/src/lib/components/PersonTypeahead.svelte index 9e9f7971..3be05bc0 100644 --- a/frontend/src/lib/components/PersonTypeahead.svelte +++ b/frontend/src/lib/components/PersonTypeahead.svelte @@ -30,8 +30,16 @@ let { onfocused }: Props = $props(); +// searchTerm must be both prop-derived AND locally writable (user typing), so $state + +// $effect is the correct pattern here — writable $derived is read-only and won't work. +// eslint-disable-next-line svelte/prefer-writable-derived let searchTerm = $state(initialName); +// Sync display text when the selected person changes externally (e.g. swap, navigation). +$effect(() => { + searchTerm = initialName; +}); + $effect(() => { const suggested = suggestedName; if (suggested && !untrack(() => value)) {