diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2025-04-20 11:09:14 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2025-04-20 12:34:29 -0300 |
commit | 3f2d714478a7c9582c492b9cdacc364cb63f417d (patch) | |
tree | ff3864ff5641e8dc97b49ae7e344efdbd27508d9 | |
parent | d947ed6fda656dc45aef36238c8e2fe4d35348a0 (diff) |
client: sidebar-search: lots of obscure filter-related fixes
-rw-r--r-- | src/static/js/client/sidebar-search.js | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/static/js/client/sidebar-search.js b/src/static/js/client/sidebar-search.js index b6008d28..051ba079 100644 --- a/src/static/js/client/sidebar-search.js +++ b/src/static/js/client/sidebar-search.js @@ -677,6 +677,8 @@ function clearSidebarSearch() { } function clearSidebarFilter() { + const {session} = info; + toggleSidebarSearchFilter(session.activeFilterType); forEachFilter((_type, filterLink) => { @@ -857,12 +859,13 @@ function showFilterElements(results) { let shownAny = false; forEachFilter((type, filterLink) => { + filterLink.classList.remove('shown', 'hidden'); + if (allReferenceTypes.includes(type)) { shownAny = true; cssProp(filterLink, 'display', null); } else { cssProp(filterLink, 'display', 'none'); - filterLink.classList.remove('shown', 'hidden'); } }); @@ -1211,8 +1214,10 @@ function toggleSidebarSearchFilter(toggleType) { filterLink.classList.add(filterActive ? 'shown' : 'hidden'); } - shownAnyResults = - fillResultElements(session.activeQueryResults, {filterType}); + if (session.activeQueryResults) { + shownAnyResults = + fillResultElements(session.activeQueryResults, {filterType}); + } session.activeFilterType = filterType; } else { @@ -1256,6 +1261,8 @@ function forgetRecentSidebarSearch() { session.activeQuery = null; session.activeQueryResults = null; + + clearSidebarFilter(); } async function handleDroppedIntoSearchInput(domEvent) { |