mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-27 16:02:26 +00:00
Watch-history cards rendered "Untitled video" / "Unknown" for newly watched videos. nostrClient.allEvents stores CONVERTED video objects (convertEventToVideo), which carry tags/pubkey but no `kind` field — only raw relay events do. resolveEventAddress() did Number(event.kind) → NaN and bailed with "", so the address (cache-by-"a"-pointer) scan matched nothing. Every video pointer (all are "a" addresses) was forced to a relay round-trip, and when that returned nothing the card showed Unknown — even though the just-watched video was sitting right there in allEvents. Fix: default to the video kind (30078) when a cached object has no `kind`, so the local cache scan resolves freshly-watched "a" pointers without a relay round-trip. Adds tests/watch-history-hydration-cache.test.mjs: relays return nothing, so a pass can only come from the cache scan (mutation-verified against the NaN-reject regression). Exports createWatchHistoryHydrationStage for boundary testing. Co-Authored-By: Claude Opus 4.8 <[email protected]>