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.
This commit is contained in:
Claude
2026-01-22 16:36:42 +00:00
parent 99bca3f8df
commit a8385db82e
2 changed files with 12 additions and 11 deletions

View File

@@ -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(() => {

View File

@@ -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