fix: stop home timeline hanging/loading when no posts are available
This commit is contained in:
parent
25fcd04d9f
commit
25b1e7229c
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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),
|
||||
|
|
Loading…
Reference in New Issue