Library tag search broken: static tagGroups, stale selections, no cache-bust #71
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Root cause
Three bugs in library.tsx, all previously fixed but lost when the UX agent rewrote the file:
Bug 1: tagGroups uses static data.tags
Line 109:
tagGroups = useMemo(() => groupTags(data.tags), [data])This shows ALL tags regardless of active collection/search. When a collection is selected, most tags are irrelevant — clicking them returns 0 results.
Fix: Recompute tags from items that pass the current collection + search filters.
Bug 2: Collection switching doesn't clear selectedTags
Lines 184, 204:
setSelectedCollection(...)withoutsetSelectedTags(new Set())Stale tag selections persist across collection changes.
Fix: Clear selectedTags when switching collections.
Bug 3: No cache-buster on fetch
Line 79:
fetch("/library.json")— browser can serve cached empty JSON forever.Fix:
fetch("/library.json?v=" + Date.now())Files
docs/src/pages/library.tsx