Handle aborted requests by returning early
This commit is contained in:
+6
-2
@@ -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 = "";
|
||||
|
||||
Reference in New Issue
Block a user