From d2b4a0290ec118c541803f31329d6e89e5fe9701 Mon Sep 17 00:00:00 2001 From: CaliBrain Date: Fri, 25 Sep 2026 21:22:42 -0400 Subject: [PATCH] fix(ui): contain the result count added in #1362 (#1363) Two regressions from the Anna's Archive search stats feature. The release modal's count block declared flex-1, so it competed with the tab strip's own flex-1 and took half the row - including on tabs whose source reports no total, where it renders nothing at all (only direct_download exposes total_results). Measured on a 1024px modal with six sources, the scrollable tab strip fell from 846px to 423px against 601px of tabs; at 375px with two sources it fell from 197px to 44px. It is now flex-none, and hidden below sm: the label alone is ~150px, which the full-screen mobile modal cannot spare. Remeasured at 693px on desktop and back to the pre-feature 197px on mobile. directTotalResults is only ever written on the direct-mode branch, and neither the universal branch nor App's resetSearchResultsState cleared it, so a count from an earlier direct search survived a mode switch and rendered over unrelated universal results. Both universal-branch reset blocks now clear it. --- src/frontend/src/components/ReleaseModal.tsx | 9 +++++++-- src/frontend/src/hooks/useSearch.ts | 6 +++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/frontend/src/components/ReleaseModal.tsx b/src/frontend/src/components/ReleaseModal.tsx index 8a532a6e..05813245 100644 --- a/src/frontend/src/components/ReleaseModal.tsx +++ b/src/frontend/src/components/ReleaseModal.tsx @@ -1806,8 +1806,13 @@ const ReleaseModalSession = ({ - {/* Center: Results count from release sources */} -
+ {/* Results count from release sources. Deliberately not flex-1: a + second growing child would halve the scrollable tab strip beside + it, and it would claim that space even on tabs whose source + reports no total (only direct_download does). Hidden below sm: + the label is ~150px and the full-screen mobile modal has no room + for it without pushing the tabs out of reach. */} +
{(() => { const searchInfo = releasesBySource[activeTab]?.search_info?.[activeTab]; const totalCount = searchInfo?.total_results; diff --git a/src/frontend/src/hooks/useSearch.ts b/src/frontend/src/hooks/useSearch.ts index 9c0b003c..973a0382 100644 --- a/src/frontend/src/hooks/useSearch.ts +++ b/src/frontend/src/hooks/useSearch.ts @@ -210,6 +210,7 @@ export function useSearch(options: UseSearchOptions): UseSearchReturn { setLastSearchQuery(''); setHasMore(false); setTotalFound(0); + setDirectTotalResults(null); setCurrentPage(1); setResultsSourceUrl(undefined); setResultsSourceTitle(undefined); @@ -219,10 +220,13 @@ export function useSearch(options: UseSearchOptions): UseSearchReturn { setIsSearching(true); setLastSearchQuery(query); - // Reset pagination for new search + // Reset pagination for new search. directTotalResults belongs to direct mode + // and is never written here, so without clearing it a count from an earlier + // direct search survives the mode switch and renders over these results. setCurrentPage(1); setHasMore(false); setTotalFound(0); + setDirectTotalResults(null); try { const result = await searchMetadata(