« get me outta code hell

client: cancel delay-search when input is cleared - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-05-05 12:38:15 -0300
committer(quasar) nebula <qznebula@protonmail.com>2024-05-31 12:11:49 -0300
commite149147ff846a91c810cf14451d711d211044a7d (patch)
treed3704246ccb70f5ffed4f3aac33a8702eae03a8a
parent5fbff602f593260b7cb0174544cd12713795de69 (diff)
client: cancel delay-search when input is cleared
-rw-r--r--src/static/js/client.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/static/js/client.js b/src/static/js/client.js
index 0d6cc4e1..d3c7f36a 100644
--- a/src/static/js/client.js
+++ b/src/static/js/client.js
@@ -3676,7 +3676,12 @@ async function activateSidebarSearch(query) {
 
 function clearSidebarSearch() {
   const info = sidebarSearchInfo;
-  const {session} = info;
+  const {session, state} = info;
+
+  if (state.stoppedTypingTimeout) {
+    clearTimeout(state.stoppedTypingTimeout);
+    state.stoppedTypingTimeout = null;
+  }
 
   info.searchInput.value = '';
   session.activeQuery = '';