mirror of
https://github.com/0PandaDEV/Qopy.git
synced 2025-04-20 12:54:05 +02:00
fix: selector not account for an existing search query
This commit is contained in:
parent
f435a7b20a
commit
828d710892
1 changed files with 16 additions and 11 deletions
|
@ -341,10 +341,7 @@ const processSearchQueue = async () => {
|
||||||
{ id: item.id, timestamp: new Date(item.timestamp) }
|
{ id: item.id, timestamp: new Date(item.timestamp) }
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
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 {
|
||||||
|
@ -357,19 +354,31 @@ const processSearchQueue = async () => {
|
||||||
|
|
||||||
const searchHistory = async (query: string): Promise<void> => {
|
const searchHistory = async (query: string): Promise<void> => {
|
||||||
searchQuery.value = query;
|
searchQuery.value = query;
|
||||||
|
|
||||||
if (searchController) {
|
if (searchController) {
|
||||||
searchController.abort();
|
searchController.abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
searchController = new AbortController();
|
searchController = new AbortController();
|
||||||
|
|
||||||
searchQueue.push(query);
|
searchQueue.push(query);
|
||||||
if (!isProcessingSearch) {
|
if (!isProcessingSearch) {
|
||||||
processSearchQueue();
|
processSearchQueue();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
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();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue