From c3d583177a2badd419d28d34854455352844bfac Mon Sep 17 00:00:00 2001 From: Bruno Charest Date: Wed, 27 May 2026 11:51:10 -0400 Subject: [PATCH] Handle aborted requests by returning early --- frontend/app.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/frontend/app.js b/frontend/app.js index fbad92a..b570d43 100644 --- a/frontend/app.js +++ b/frontend/app.js @@ -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 = "";