From a8385db82e5f505cafae57fed9ff26ef7605bd17 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 22 Jan 2026 16:36:42 +0000 Subject: [PATCH] fix: resolve TypeScript errors in ProfileViewer and test file - Use use$ hook to subscribe to Observable from eventStore.replaceable() - Add explicit type annotations for tag arrays to avoid implicit any - Remove unused hex2 variable from test All tests passing (1017/1017) and build successful. --- src/components/ProfileViewer.tsx | 22 ++++++++++++---------- src/lib/spell-conversion.test.ts | 1 - 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/components/ProfileViewer.tsx b/src/components/ProfileViewer.tsx index f739ad8..0b45b33 100644 --- a/src/components/ProfileViewer.tsx +++ b/src/components/ProfileViewer.tsx @@ -73,20 +73,22 @@ function SpellTabContent({ const eventStore = useEventStore(); // Fetch target pubkey's contacts (kind 3 contact list) + const contactListEvent = use$( + () => + targetPubkey + ? eventStore.replaceable(kinds.Contacts, targetPubkey) + : undefined, + [targetPubkey, eventStore], + ); + const targetContacts = useMemo(() => { - if (!targetPubkey) return []; + if (!contactListEvent) return []; try { - const contactListEvent = eventStore.replaceable( - kinds.Contacts, - targetPubkey, - ); - if (!contactListEvent) return []; - // Extract pubkeys from p tags const contacts = contactListEvent.tags - .filter((tag) => tag[0] === "p" && tag[1]) - .map((tag) => tag[1]); + .filter((tag: string[]) => tag[0] === "p" && tag[1]) + .map((tag: string[]) => tag[1]); console.log( `[SpellTabContent:${spell.name || spellId}] Target contacts:`, @@ -104,7 +106,7 @@ function SpellTabContent({ ); return []; } - }, [targetPubkey, eventStore, spell.name, spellId]); + }, [contactListEvent, targetPubkey, spell.name, spellId]); // Parse spell and get filter - handle both published (with event) and local (command-only) spells const parsed = useMemo(() => { diff --git a/src/lib/spell-conversion.test.ts b/src/lib/spell-conversion.test.ts index 6dc82db..9de464e 100644 --- a/src/lib/spell-conversion.test.ts +++ b/src/lib/spell-conversion.test.ts @@ -1299,7 +1299,6 @@ describe("Spell Conversion", () => { it("should work end-to-end: encode → decode → apply", () => { const hex1 = "a".repeat(64); - const hex2 = "b".repeat(64); // Create parameterized spell using $me as placeholder // Encoding will convert $me to $pubkey automatically