mirror of
https://github.com/aljazceru/ditto.git
synced 2026-01-19 21:34:22 +01:00
fix: stop home timeline hanging/loading when no posts are available
This commit is contained in:
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user