From 7820f88859657e47ada4d6d2dba1a216ed5b78f0 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Thu, 11 May 2023 20:10:11 -0500 Subject: [PATCH] timelines: bail early if there are no events --- src/controllers/api/timelines.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/controllers/api/timelines.ts b/src/controllers/api/timelines.ts index 0264d83b..8e109071 100644 --- a/src/controllers/api/timelines.ts +++ b/src/controllers/api/timelines.ts @@ -16,6 +16,10 @@ const homeController: AppController = async (c) => { } const events = await getFeed(follows, { since, until }); + if (!events.length) { + return c.json([]); + } + const statuses = (await Promise.all(events.map(toStatus))).filter(Boolean); const next = `${LOCAL_DOMAIN}/api/v1/timelines/home?until=${events[events.length - 1].created_at}`;