« get me outta code hell

avoid replacing results after focusing - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/static/js/client/sidebar-search.js
diff options
context:
space:
mode:
authorleo60228 <leo@60228.dev>2024-09-11 18:28:06 -0400
committer(quasar) nebula <qznebula@protonmail.com>2025-01-10 18:51:25 -0400
commitca03d7becf6eff26664d3aab7e43a14f5f6c62c9 (patch)
treef9e8a4a4b837a86379d16a0422d0aa9d431b5e25 /src/static/js/client/sidebar-search.js
parent55dad23c4b65f9040b6b3e97c05813263b009ef7 (diff)
avoid replacing results after focusing
Diffstat (limited to 'src/static/js/client/sidebar-search.js')
-rw-r--r--src/static/js/client/sidebar-search.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/static/js/client/sidebar-search.js b/src/static/js/client/sidebar-search.js
index 34d2161f..ae18c930 100644
--- a/src/static/js/client/sidebar-search.js
+++ b/src/static/js/client/sidebar-search.js
@@ -303,15 +303,20 @@ export function mutatePageContent() {
 export function addPageListeners() {
   if (!info.searchInput) return;
 
+  let prevValue = null;
   info.searchInput.addEventListener('change', _domEvent => {
-    if (info.searchInput.value) {
+    if (info.searchInput.value && info.searchInput.value !== prevValue) {
       activateSidebarSearch(info.searchInput.value);
     }
+    prevValue = info.searchInput.value;
   });
 
   info.searchInput.addEventListener('input', _domEvent => {
     const {settings, state} = info;
 
+    if (prevValue === info.searchInput.value) return;
+    prevValue = info.searchInput.value;
+
     if (!info.searchInput.value) {
       clearSidebarSearch();
       return;