fix: stop home timeline hanging/loading when no posts are available

This commit is contained in:
P. Reis 2024-04-07 20:26:47 -03:00
parent 25fcd04d9f
commit 25b1e7229c
2 changed files with 8 additions and 2 deletions

View File

@ -56,12 +56,17 @@ async function renderStatuses(c: AppContext, filters: NostrFilter[]) {
return c.json([]);
}
const statuses = await Promise.all(events.map((event) => {
const statuses = (await Promise.all(events.map((event) => {
if (event.kind === 6) {
return renderReblog(event);
}
return renderStatus(event, c.get('pubkey'));
}));
}))).filter((boolean) => boolean);
if (!statuses.length) {
return c.json([]);
}
return paginated(c, events, statuses);
}

View File

@ -111,6 +111,7 @@ async function renderReblog(event: DittoEvent) {
if (!event.repost) return;
const reblog = await renderStatus(event.repost);
reblog.reblogged = true;
return {
id: event.id,
account: await renderAccount(event.author),