diff --git a/src/components/CountViewer.tsx b/src/components/CountViewer.tsx index efa7f9f..3608d8f 100644 --- a/src/components/CountViewer.tsx +++ b/src/components/CountViewer.tsx @@ -86,7 +86,7 @@ export function CountViewer({ const contactPointer = useMemo( () => needsAccount && accountPubkey - ? ({ kind: 3, pubkey: accountPubkey, identifier: "" } as const) + ? { kind: 3, pubkey: accountPubkey, identifier: "" } : undefined, [needsAccount, accountPubkey], ); @@ -97,7 +97,9 @@ export function CountViewer({ // Extract contact pubkeys from kind 3 event const contacts = useMemo(() => { if (!contactListEvent) return []; - return getTagValues(contactListEvent, "p").filter((pk) => pk.length === 64); + return getTagValues(contactListEvent, "p").filter( + (pk): pk is string => typeof pk === "string" && pk.length === 64, + ); }, [contactListEvent]); // Resolve filter aliases ($me, $contacts) if needed @@ -161,11 +163,11 @@ export function CountViewer({ }; // Extract tag filters for display - const authorPubkeys = filter.authors || []; - const pTagPubkeys = filter["#p"] || []; - const eTags = filter["#e"]; - const tTags = filter["#t"]; - const dTags = filter["#d"]; + const authorPubkeys = Array.isArray(filter.authors) ? filter.authors : []; + const pTagPubkeys = Array.isArray(filter["#p"]) ? filter["#p"] : []; + const eTags = Array.isArray(filter["#e"]) ? filter["#e"] : undefined; + const tTags = Array.isArray(filter["#t"]) ? filter["#t"] : undefined; + const dTags = Array.isArray(filter["#d"]) ? filter["#d"] : undefined; return (