Merge branch 'refactor-get-descendants' into 'main'
Convert getDescendants to async function See merge request soapbox-pub/ditto!195
This commit is contained in:
commit
d1b2e26abf
|
@ -82,9 +82,9 @@ async function getAncestors(event: NostrEvent, result: NostrEvent[] = []): Promi
|
||||||
return result.reverse();
|
return result.reverse();
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDescendants(eventId: string, signal = AbortSignal.timeout(2000)): Promise<NostrEvent[]> {
|
async function getDescendants(eventId: string, signal = AbortSignal.timeout(2000)): Promise<NostrEvent[]> {
|
||||||
return eventsDB.query([{ kinds: [1], '#e': [eventId] }], { limit: 200, signal })
|
const events = await eventsDB.query([{ kinds: [1], '#e': [eventId] }], { limit: 200, signal });
|
||||||
.then((events) => hydrateEvents({ events, storage: eventsDB, signal }));
|
return hydrateEvents({ events, storage: eventsDB, signal });
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns whether the pubkey is followed by a local user. */
|
/** Returns whether the pubkey is followed by a local user. */
|
||||||
|
|
Loading…
Reference in New Issue