« get me outta code hell

client: sidebar-search: don't record homepage as context - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/static/js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2026-02-12 18:03:20 -0400
committer(quasar) nebula <qznebula@protonmail.com>2026-02-12 18:04:46 -0400
commit4e49f28f75a5ae280c1b32f7109e4911da439905 (patch)
treec8b141c76298b8e7de812060c0ce778594b4cc50 /src/static/js
parente82707fadb8a441c9ef8dc2de85a34d53d7c5abe (diff)
client: sidebar-search: don't record homepage as context
Diffstat (limited to 'src/static/js')
-rw-r--r--src/static/js/client/sidebar-search.js30
1 files changed, 20 insertions, 10 deletions
diff --git a/src/static/js/client/sidebar-search.js b/src/static/js/client/sidebar-search.js
index 5b3c0ee1..519fd269 100644
--- a/src/static/js/client/sidebar-search.js
+++ b/src/static/js/client/sidebar-search.js
@@ -701,16 +701,7 @@ async function activateSidebarSearch(query) {
   state.searchStage = 'complete';
   updateSidebarSearchStatus();
 
-  session.activeQueryContextPageName =
-    document.querySelector('title').dataset.withoutWikiName ??
-    document.title;
-
-  session.activeQueryContextPagePathname =
-    location.pathname;
-
-  session.activeQueryContextPageColor =
-    document.querySelector('.color-style')?.dataset.color ??
-    null;
+  recordActiveQueryContext();
 
   session.activeQuery = query;
   session.activeQueryResults = results;
@@ -725,6 +716,25 @@ async function activateSidebarSearch(query) {
   }
 }
 
+function recordActiveQueryContext() {
+  const {session} = info;
+
+  if (document.documentElement.dataset.urlKey === 'localized.home') {
+    return;
+  }
+
+  session.activeQueryContextPageName =
+    document.querySelector('title').dataset.withoutWikiName ??
+    document.title;
+
+  session.activeQueryContextPagePathname =
+    location.pathname;
+
+  session.activeQueryContextPageColor =
+    document.querySelector('.color-style')?.dataset.color ??
+    null;
+}
+
 function clearSidebarSearch() {
   const {session, state} = info;