fix: reactivity warnings in searchbox
This commit is contained in:
@@ -33,9 +33,13 @@
|
|||||||
let isFocus = $state(false);
|
let isFocus = $state(false);
|
||||||
let close: (() => Promise<void>) | undefined;
|
let close: (() => Promise<void>) | undefined;
|
||||||
|
|
||||||
|
let navigating = false;
|
||||||
const listboxId = generateId();
|
const listboxId = generateId();
|
||||||
|
|
||||||
onDestroy(() => {
|
onDestroy(() => {
|
||||||
|
if (navigating) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
searchStore.isSearchEnabled = false;
|
searchStore.isSearchEnabled = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -44,6 +48,7 @@
|
|||||||
|
|
||||||
closeDropdown();
|
closeDropdown();
|
||||||
searchStore.isSearchEnabled = false;
|
searchStore.isSearchEnabled = false;
|
||||||
|
navigating = true;
|
||||||
await goto(`${AppRoute.SEARCH}?${params}`);
|
await goto(`${AppRoute.SEARCH}?${params}`);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -73,6 +78,9 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onFocusOut = () => {
|
const onFocusOut = () => {
|
||||||
|
if (navigating) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
searchStore.isSearchEnabled = false;
|
searchStore.isSearchEnabled = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -161,6 +169,9 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
const closeDropdown = () => {
|
const closeDropdown = () => {
|
||||||
|
if (navigating) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
showSuggestions = false;
|
showSuggestions = false;
|
||||||
isFocus = false;
|
isFocus = false;
|
||||||
searchHistoryBox?.clearSelection();
|
searchHistoryBox?.clearSelection();
|
||||||
|
|||||||
Reference in New Issue
Block a user