fix: history returning no entries until query update and minisearch conflicts

This commit is contained in:
Andrew Bastin
2023-07-04 14:54:30 +05:30
parent 235deb113c
commit ea03223b8e

View File

@@ -68,11 +68,15 @@ export class HistorySpotlightSearcherService
this.clearHistoryActionEnabled, this.clearHistoryActionEnabled,
(enabled) => { (enabled) => {
if (enabled) { if (enabled) {
if (minisearch.has("clear-history")) return
minisearch.add({ minisearch.add({
id: "clear-history", id: "clear-history",
title: this.t("action.clear_history"), title: this.t("action.clear_history"),
}) })
} else { } else {
if (!minisearch.has("clear-history")) return
minisearch.discard("clear-history") minisearch.discard("clear-history")
} }
}, },
@@ -101,7 +105,9 @@ export class HistorySpotlightSearcherService
const scopeHandle = effectScope() const scopeHandle = effectScope()
scopeHandle.run(() => { scopeHandle.run(() => {
watch(query, (query) => { watch(
[query, this.clearHistoryActionEnabled],
([query]) => {
results.value = minisearch results.value = minisearch
.search(query, { .search(query, {
prefix: true, prefix: true,
@@ -142,7 +148,9 @@ export class HistorySpotlightSearcherService
}, },
} }
}) })
}) },
{ immediate: true }
)
}) })
const onSessionEnd = () => { const onSessionEnd = () => {