fix: selector not account for an existing search query

This commit is contained in:
pandadev 2025-03-15 17:47:19 +01:00
parent f435a7b20a
commit 828d710892
No known key found for this signature in database
GPG key ID: C39629DACB8E762F

View file

@ -342,9 +342,6 @@ const processSearchQueue = async () => {
) )
); );
if (groupedHistory.value.length > 0) {
handleSelection(0, 0, false);
}
} catch (error) { } catch (error) {
console.error("Search error:", error); console.error("Search error:", error);
} finally { } finally {
@ -370,6 +367,18 @@ const searchHistory = async (query: string): Promise<void> => {
} }
}; };
watch(
() => groupedHistory.value,
(newGroupedHistory) => {
if (newGroupedHistory.length > 0) {
handleSelection(0, 0, true);
} else {
selectItem(-1, -1);
}
},
{ deep: true }
);
const pasteSelectedItem = async (): Promise<void> => { const pasteSelectedItem = async (): Promise<void> => {
if (!selectedItem.value) return; if (!selectedItem.value) return;
@ -608,10 +617,6 @@ watch(
{ flush: "post" } { flush: "post" }
); );
watch(searchQuery, () => {
searchHistory(searchQuery.value);
});
onMounted(async () => { onMounted(async () => {
try { try {
os.value = platform(); os.value = platform();