mirror of
https://github.com/purrgrammer/grimoire.git
synced 2026-06-16 17:48:34 +02:00
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:
@@ -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(() => {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user