diff --git a/src/lib/components/Searchbar.svelte b/src/lib/components/Searchbar.svelte index eed17af5..e7964f79 100644 --- a/src/lib/components/Searchbar.svelte +++ b/src/lib/components/Searchbar.svelte @@ -73,7 +73,7 @@ closePopup?.dispatchEvent(new MouseEvent("click")); } - await goto( + goto( `/${assetType === "ETF" ? "etf" : assetType === "Index" ? "index" : "stocks"}/${symbol}`, ); @@ -168,8 +168,8 @@ `/api/searchbar?query=${encodeURIComponent(inputValue)}&limit=10`, ); searchBarData = await response?.json(); - }, 50); // delay - isLoading = false; + isLoading = false; + }, 300); // delay } function handleKeyDown(symbol) { @@ -251,7 +251,7 @@ ) { (async () => { // Add 500 ms delay is important otherwise bug since #each has searchHistory and updates too quickly and redirects to wrong symbol - await new Promise((resolve) => setTimeout(resolve, 500)); + await new Promise((resolve) => setTimeout(resolve, 800)); // Update search history after delay searchHistory = updatedSearchHistory; @@ -330,7 +330,13 @@