diff --git a/site/content/examples/20-7guis/05-7guis-crud/App.svelte b/site/content/examples/20-7guis/05-7guis-crud/App.svelte index 68574bca43..67145ceec7 100644 --- a/site/content/examples/20-7guis/05-7guis-crud/App.svelte +++ b/site/content/examples/20-7guis/05-7guis-crud/App.svelte @@ -28,6 +28,11 @@ }) : people.map(person => Object({ matched: true, person: person })); + $: if (!filteredPeople[i].matched) { + let newIndex = filteredPeople.findIndex(person => person.matched); + if (newIndex >= 0) i = newIndex; + } + $: selected = filteredPeople[i].person; $: reset_inputs(selected);