diff --git a/web/src/lib/components/shared-components/change-location.svelte b/web/src/lib/components/shared-components/change-location.svelte index 862ab913a2..f8d86929cb 100644 --- a/web/src/lib/components/shared-components/change-location.svelte +++ b/web/src/lib/components/shared-components/change-location.svelte @@ -69,15 +69,18 @@ }; const handleSearchPlaces = () => { - if (searchWord === '') { - return; - } - if (latestSearchTimeout) { clearTimeout(latestSearchTimeout); } showLoadingSpinner = true; + const searchTimeout = window.setTimeout(() => { + if (searchWord === '') { + places = []; + showLoadingSpinner = false; + return; + } + searchPlaces({ name: searchWord }) .then((searchResult) => { // skip result when a newer search is happening