Library tag search broken: static tagGroups, stale selections, no cache-bust #71

Closed
opened 2026-03-21 20:02:09 +00:00 by kert · 0 comments
Owner

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(...) without setSelectedTags(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
## 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(...)` without `setSelectedTags(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`
kert added this to the P13: Docs Search — local search, library data, broken links, tests milestone 2026-03-21 20:02:09 +00:00
kert added the docs label 2026-03-21 20:02:09 +00:00
kert closed this issue 2026-03-21 20:04:56 +00:00
Sign in to join this conversation.