Handle aborted requests by returning early

This commit is contained in:
2026-05-27 11:51:10 -04:00
parent 96218f872e
commit c3d583177a
+6 -2
View File
@@ -499,7 +499,8 @@
this._titlesSection.hidden = !(titlesRes.suggestions || []).length;
if (titlesRes.suggestions?.length) this.show();
} catch (err) {
if (err.name !== "AbortError") this._titlesSection.hidden = true;
if (err.name === "AbortError") return; // new request superseded this one
this._titlesSection.hidden = true;
}
try {
const tagsRes = await api(`/api/tags/suggest?q=${encodeURIComponent(prefix)}&vault=${encodeURIComponent(vault)}&limit=5`, { signal: suggestAbortController.signal });
@@ -507,10 +508,13 @@
this._tagsSection.hidden = !(tagsRes.suggestions || []).length;
if (tagsRes.suggestions?.length) this.show();
} catch (err) {
if (err.name !== "AbortError") this._tagsSection.hidden = true;
if (err.name === "AbortError") return;
this._tagsSection.hidden = true;
}
this._collectItems();
},
this._collectItems();
},
_renderHistory(items, query) {
this._historyList.innerHTML = "";