fix: history returning no entries until query update and minisearch conflicts
This commit is contained in:
@@ -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,48 +105,52 @@ export class HistorySpotlightSearcherService
|
|||||||
const scopeHandle = effectScope()
|
const scopeHandle = effectScope()
|
||||||
|
|
||||||
scopeHandle.run(() => {
|
scopeHandle.run(() => {
|
||||||
watch(query, (query) => {
|
watch(
|
||||||
results.value = minisearch
|
[query, this.clearHistoryActionEnabled],
|
||||||
.search(query, {
|
([query]) => {
|
||||||
prefix: true,
|
results.value = minisearch
|
||||||
fuzzy: true,
|
.search(query, {
|
||||||
boost: {
|
prefix: true,
|
||||||
reltime: 2,
|
fuzzy: true,
|
||||||
},
|
boost: {
|
||||||
weights: {
|
reltime: 2,
|
||||||
fuzzy: 0.2,
|
},
|
||||||
prefix: 0.8,
|
weights: {
|
||||||
},
|
fuzzy: 0.2,
|
||||||
})
|
prefix: 0.8,
|
||||||
.map((x) => {
|
},
|
||||||
const entry = restHistoryStore.value.state[parseInt(x.id)]
|
})
|
||||||
|
.map((x) => {
|
||||||
|
const entry = restHistoryStore.value.state[parseInt(x.id)]
|
||||||
|
|
||||||
|
if (x.id === "clear-history") {
|
||||||
|
return {
|
||||||
|
id: "clear-history",
|
||||||
|
icon: markRaw(IconTrash2),
|
||||||
|
score: x.score,
|
||||||
|
text: {
|
||||||
|
type: "text",
|
||||||
|
text: this.t("action.clear_history"),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (x.id === "clear-history") {
|
|
||||||
return {
|
return {
|
||||||
id: "clear-history",
|
id: x.id,
|
||||||
icon: markRaw(IconTrash2),
|
icon: markRaw(IconHistory),
|
||||||
score: x.score,
|
score: x.score,
|
||||||
text: {
|
text: {
|
||||||
type: "text",
|
type: "custom",
|
||||||
text: this.t("action.clear_history"),
|
component: markRaw(SpotlightHistoryEntry),
|
||||||
|
componentProps: {
|
||||||
|
historyEntry: entry,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
|
},
|
||||||
return {
|
{ immediate: true }
|
||||||
id: x.id,
|
)
|
||||||
icon: markRaw(IconHistory),
|
|
||||||
score: x.score,
|
|
||||||
text: {
|
|
||||||
type: "custom",
|
|
||||||
component: markRaw(SpotlightHistoryEntry),
|
|
||||||
componentProps: {
|
|
||||||
historyEntry: entry,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const onSessionEnd = () => {
|
const onSessionEnd = () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user