diff --git a/src/lib/components/layout/Sidebar/SearchInput.svelte b/src/lib/components/layout/Sidebar/SearchInput.svelte index e49f9b0359..fc89a93460 100644 --- a/src/lib/components/layout/Sidebar/SearchInput.svelte +++ b/src/lib/components/layout/Sidebar/SearchInput.svelte @@ -136,6 +136,7 @@ const initTags = async () => { loading = true; + await tags.set(await getAllTags(localStorage.token)); loading = false; }; @@ -144,26 +145,6 @@ value = ''; dispatch('input'); }; - - const documentClickHandler = (e) => { - const searchContainer = document.getElementById('search-container'); - const chatSearch = document.getElementById('chat-search'); - - if (!searchContainer.contains(e.target) && !chatSearch.contains(e.target)) { - if (e.target.id.startsWith('search-tag-') || e.target.id.startsWith('search-option-')) { - return; - } - focused = false; - } - }; - - onMount(() => { - document.addEventListener('click', documentClickHandler); - }); - - onDestroy(() => { - document.removeEventListener('click', documentClickHandler); - });
@@ -182,6 +163,7 @@ dispatch('input'); }} on:focus={() => { + hovering = false; focused = true; initTags(); }} @@ -258,8 +240,8 @@ selectedIdx = null; }} on:mouseleave={() => { - selectedIdx = 0; hovering = false; + selectedIdx = 0; }} >