« get me outta code hell

client: sidebar-search: zap subsequent context from homepage - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2026-03-31 09:23:40 -0300
committer(quasar) nebula <qznebula@protonmail.com>2026-03-31 09:23:40 -0300
commit4b078fa2ee0dd3472b27556bab189c7b551c2313 (patch)
treeeb108870db58b61cc35d7a8aa4e2e32a5b676942 /src
parent833896c1455b9ad316ca658aff75057d310c33d1 (diff)
client: sidebar-search: zap subsequent context from homepage
Diffstat (limited to 'src')
-rw-r--r--src/static/js/client/sidebar-search.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/static/js/client/sidebar-search.js b/src/static/js/client/sidebar-search.js
index 87da7055..0d1dbaaf 100644
--- a/src/static/js/client/sidebar-search.js
+++ b/src/static/js/client/sidebar-search.js
@@ -127,6 +127,7 @@ export const info = {
     activeQueryContextPageName: {type: 'string'},
     activeQueryContextPagePathname: {type: 'string'},
     activeQueryContextPageColor: {type: 'string'},
+    zapActiveQueryContext: {type: 'boolean'},
 
     activeQueryResults: {
       type: 'json',
@@ -163,6 +164,8 @@ export function* bindSessionStorage() {
     yield 'activeQueryContextPageName';
     yield 'activeQueryContextPagePathname';
     yield 'activeQueryContextPageColor';
+    yield 'zapActiveQueryContext';
+
     yield 'activeQueryResults';
     yield 'activeFilterType';
     yield 'resultsScrollOffset';
@@ -750,6 +753,15 @@ function recordActiveQueryContext() {
   const {session} = info;
 
   if (document.documentElement.dataset.urlKey === 'localized.home') {
+    session.activeQueryContextPageName = null;
+    session.activeQueryContextPagePathname = null;
+    session.activeQueryContextPageColor = null;
+    session.zapActiveQueryContext = true;
+    return;
+  }
+
+  // Zapping means subsequent searches don't record context.
+  if (session.zapActiveQueryContext) {
     return;
   }
 
@@ -795,6 +807,7 @@ function clearActiveQuery() {
   session.activeQueryContextPageName = null;
   session.activeQueryContextPagePathname = null;
   session.activeQueryContextPageColor = null;
+  session.zapActiveQueryContext = false;
 }
 
 function clearSidebarFilter() {