diff options
Diffstat (limited to 'src/static/js')
| -rw-r--r-- | src/static/js/client/sidebar-search.js | 30 |
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; |