mirror of
https://github.com/calibrain/shelfmark.git
synced 2026-10-05 11:31:12 +01:00
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.
This commit is contained in:
@@ -1806,8 +1806,13 @@ const ReleaseModalSession = ({
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Center: Results count from release sources */}
|
||||
<div className="flex flex-1 justify-center">
|
||||
{/* 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. */}
|
||||
<div className="hidden flex-none justify-center sm:flex">
|
||||
{(() => {
|
||||
const searchInfo = releasesBySource[activeTab]?.search_info?.[activeTab];
|
||||
const totalCount = searchInfo?.total_results;
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user