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([]);
|
return c.json([]);
|
||||||
}
|
}
|
||||||
|
|
||||||
const statuses = await Promise.all(events.map((event) => {
|
const statuses = (await Promise.all(events.map((event) => {
|
||||||
if (event.kind === 6) {
|
if (event.kind === 6) {
|
||||||
return renderReblog(event);
|
return renderReblog(event);
|
||||||
}
|
}
|
||||||
return renderStatus(event, c.get('pubkey'));
|
return renderStatus(event, c.get('pubkey'));
|
||||||
}));
|
}))).filter((boolean) => boolean);
|
||||||
|
|
||||||
|
if (!statuses.length) {
|
||||||
|
return c.json([]);
|
||||||
|
}
|
||||||
|
|
||||||
return paginated(c, events, statuses);
|
return paginated(c, events, statuses);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,6 +111,7 @@ async function renderReblog(event: DittoEvent) {
|
|||||||
if (!event.repost) return;
|
if (!event.repost) return;
|
||||||
|
|
||||||
const reblog = await renderStatus(event.repost);
|
const reblog = await renderStatus(event.repost);
|
||||||
|
reblog.reblogged = true;
|
||||||
return {
|
return {
|
||||||
id: event.id,
|
id: event.id,
|
||||||
account: await renderAccount(event.author),
|
account: await renderAccount(event.author),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user