discard stale help searches

This commit is contained in:
Abhinav Raut
2026-09-18 16:40:00 +05:30
parent 23b4dea6f2
commit 658e4e00a5
+5 -4
View File
@@ -61,7 +61,8 @@ const retry = () => {
}
const search = async () => {
if (busy.value) return
if (!help.query.trim()) {
const query = help.query.trim()
if (!query) {
help.results = null
return
}
@@ -69,11 +70,11 @@ const search = async () => {
error.value = ''
const identity = help.identity
try {
const response = await api.searchHelp(help.query.trim(), help.data.locale)
if (!valid(identity)) return
const response = await api.searchHelp(query, help.data.locale)
if (!valid(identity) || help.query.trim() !== query) return
help.results = response.data.data || []
} catch {
if (valid(identity)) {
if (valid(identity) && help.query.trim() === query) {
error.value = t('widget.helpLoadError')
help.failed = true
}