Skip to content

High performance self-hosted photo and video management solution.

fix(web): Add debouncing to the search popup form (#13684)

Pranay Pandey7e9fb5df5e9a
diff --git a/web/src/lib/components/shared-components/search-bar/search-bar.svelte b/web/src/lib/components/shared-components/search-bar/search-bar.svelte
index b0bbdbe71f..67c3cfe757 100644
--- a/web/src/lib/components/shared-components/search-bar/search-bar.svelte
+++ b/web/src/lib/components/shared-components/search-bar/search-bar.svelte
@@ -66,13 +66,17 @@
};
const onFocusOut = () => {
- if ($isSearchEnabled) {
- $preventRaceConditionSearchBar = true;
- }
+ const focusOutTimer = setTimeout(() => {
+ if ($isSearchEnabled) {
+ $preventRaceConditionSearchBar = true;
+ }
- closeDropdown();
- $isSearchEnabled = false;
- showFilter = false;
+ closeDropdown();
+ $isSearchEnabled = false;
+ showFilter = false;
+ }, 100);
+
+ clearTimeout(focusOutTimer);
};
const onHistoryTermClick = async (searchTerm: string) => {