refactor(queries): convert getDescendants to async function

This commit is contained in:
P. Reis 2024-04-30 11:18:20 -03:00
parent 36aaf79a74
commit d99fd753ee
1 changed files with 3 additions and 3 deletions

View File

@ -82,9 +82,9 @@ async function getAncestors(event: NostrEvent, result: NostrEvent[] = []): Promi
return result.reverse();
}
function getDescendants(eventId: string, signal = AbortSignal.timeout(2000)): Promise<NostrEvent[]> {
return eventsDB.query([{ kinds: [1], '#e': [eventId] }], { limit: 200, signal })
.then((events) => hydrateEvents({ events, storage: eventsDB, signal }));
async function getDescendants(eventId: string, signal = AbortSignal.timeout(2000)): Promise<NostrEvent[]> {
const events = await eventsDB.query([{ kinds: [1], '#e': [eventId] }], { limit: 200, signal });
return hydrateEvents({ events, storage: eventsDB, signal });
}
/** Returns whether the pubkey is followed by a local user. */