fix(ui): the filter rail shows no tag counts until the facets land

It printed the tag's whole-library count as the current filter's while the
facets loaded, and for good when they failed: live, "Music 238" beside a
search that matched 3 of its channels. Ordering still falls back to it.
This commit is contained in:
2026-10-03 02:43:52 +02:00
parent b40440b825
commit a4775e1cd0
3 changed files with 38 additions and 6 deletions
+14
View File
@@ -0,0 +1,14 @@
import type { Tag } from "../lib/api";
import type { ComboboxOption } from "./ui/Combobox";
// A tag as a filter row: its count is the CURRENT filter's (the summary's facets), or none at all while
// the facets load or after they failed. The rail printed the tag's whole-library count in that gap, as
// if it were the filter's: "Music 238" beside a search that matched 3 of its channels (E31 review 2).
export const facetOption = (
tag: Tag,
facets: Record<string, number> | undefined,
): ComboboxOption => ({
value: String(tag.id),
label: tag.name,
count: facets ? (facets[String(tag.id)] ?? 0) : undefined,
});