mirror of
https://github.com/nunocoracao/blowfish.git
synced 2026-10-10 22:09:31 +00:00
Merge pull request #2929 from kamilsi/fix/search-race-condition
🐛 fix: race condition in search query execution
This commit is contained in:
1 file changed
+7
-1
+7
-1
@@ -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;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user