Merge pull request #2929 from kamilsi/fix/search-race-condition

🐛 fix: race condition in search query execution
This commit is contained in:
Nuno C. authored and GitHub committed 2026-07-02 12:20:54 +01:00
commit bdb41a342f
1 file changed
+7 -1
+7 -1
View File
@@ -151,6 +151,12 @@ function buildIndex() {
}
function executeQuery(term) {
if (!indexed) {
buildIndex();
}
if (!fuse) {
return;
}
let results = fuse.search(term);
let resultsHTML = "";
@@ -193,7 +199,7 @@ function executeQuery(term) {
}
output.innerHTML = resultsHTML;
if (results.length > 0) {
if (results.length > 0 && output.firstChild) {
first = output.firstChild.firstElementChild;
last = output.lastChild.firstElementChild;
}