diff --git a/src/lib/components/input/search.svelte b/src/lib/components/input/search.svelte index 61c0567f..ccb16437 100644 --- a/src/lib/components/input/search.svelte +++ b/src/lib/components/input/search.svelte @@ -7,7 +7,7 @@ import { preventDefault } from '$lib/utils'; import { goto } from '$app/navigation'; import { fade, scale } from 'svelte/transition'; - import { ArrowLeftRight, Box, Key, SearchIcon, UserSearch } from 'lucide-svelte'; + import { ArrowLeftRight, Box, Key, SearchIcon, UserSearch, X } from 'lucide-svelte'; import { SearchHistory } from '$lib/state/search.svelte'; import Button from '$lib/components/button/button.svelte'; import { Stack } from '$lib/components/layout'; @@ -31,7 +31,7 @@ let selectedIndex: number | undefined = $state(); const searchHistory = new SearchHistory(); - const history = searchHistory.get(); + const history = $derived(searchHistory.get()); const searchType = $derived.by(() => { /* eslint-disable @typescript-eslint/no-unused-vars */ @@ -126,7 +126,7 @@ } if (selectedIndex !== undefined && event.key === 'Enter') { - goTosearchHistory(history[selectedIndex].result); + goToSearchHistory(history[selectedIndex].result); } } } @@ -144,7 +144,7 @@ searchValue = ''; } - function goTosearchHistory(url: string) { + function goToSearchHistory(url: string) { goto(url); closeSearch(); } @@ -214,49 +214,59 @@ {#if history.length}