From c094d9e6a1b40f571098718372315d5b495229aa Mon Sep 17 00:00:00 2001 From: partisan Date: Thu, 26 Sep 2024 19:54:41 +0200 Subject: [PATCH] fixed issue where search suggestions happened twice, causing weird behavior --- static/js/autocomplete.js | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/static/js/autocomplete.js b/static/js/autocomplete.js index 3e1cb58..3c7a2f5 100644 --- a/static/js/autocomplete.js +++ b/static/js/autocomplete.js @@ -52,6 +52,7 @@ async function getSuggestions(query) { let currentIndex = -1; // Keep track of the currently selected suggestion +// Handle click events on the type buttons let results = []; searchInput.addEventListener('input', async () => { let input = searchInput.value; @@ -128,15 +129,6 @@ function renderResults(results) { resultsWrapper.innerHTML = ``; } -// Function to handle search input -searchInput.addEventListener('input', async () => { - let input = searchInput.value; - if (input.length) { - const results = await getSuggestions(input); - renderResults(results); - } -}); - // Handle click events on the type buttons const typeButtons = document.querySelectorAll('[name="t"]'); typeButtons.forEach(button => {