Make homepage queries resilient to error for initial setup

This commit is contained in:
Sam Becker 2024-01-07 12:41:24 -06:00
parent 756cbc7f1b
commit 4d5249cc08

View File

@ -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;