From 4d5249cc08a4402fd6c92be3358952460289587a Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Sun, 7 Jan 2024 12:41:24 -0600 Subject: [PATCH] Make homepage queries resilient to error for initial setup --- src/app/page.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/app/page.tsx b/src/app/page.tsx index 78fbea0b..2e1cdfc1 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -27,8 +27,10 @@ export default async function HomePage({ searchParams }: PaginationParams) { photos, count, ] = await Promise.all([ - getPhotosCached({ limit }), - getPhotosCountCached(), + // Make homepage queries resilient to error + // for initial setup when database may not exist + getPhotosCached({ limit }).catch(() => []), + getPhotosCountCached().catch(() => 0), ]); const showMorePhotos = count > photos.length;