From 443aba830fdf7409d1e5afa1dc4a50b9b021b795 Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Fri, 11 Jul 2025 23:12:27 -0500 Subject: [PATCH] Gracefully fail when there are no recents --- src/category/data.ts | 9 +++++---- src/components/primitives/ResponsiveText.tsx | 1 - 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/category/data.ts b/src/category/data.ts index 0d68fba9..dc284227 100644 --- a/src/category/data.ts +++ b/src/category/data.ts @@ -39,10 +39,11 @@ export const NULL_CATEGORY_DATA: CategoryData = { export const getDataForCategories = () => Promise.all([ SHOW_RECENTS ? getPhotosMeta({ recent: true }) - .then(({ count, dateRange }) => [{ - count, - lastModified: new Date(dateRange?.end ?? ''), - }]) + .then(({ count, dateRange }) => count && dateRange + ? [{ + count, + lastModified: new Date(dateRange?.end ?? ''), + }] : undefined) .catch(() => []) : undefined, SHOW_YEARS diff --git a/src/components/primitives/ResponsiveText.tsx b/src/components/primitives/ResponsiveText.tsx index a130c0a5..efbc068f 100644 --- a/src/components/primitives/ResponsiveText.tsx +++ b/src/components/primitives/ResponsiveText.tsx @@ -20,7 +20,6 @@ export default function ResponsiveText({ const textLength = typeof children === 'string' ? children.length : 0; - console.log(textLength); return textLength >= CHARACTER_CUTOFF_LG ? { short: 'lg:hidden', long: 'max-lg:hidden' } : textLength >= CHARACTER_CUTOFF_MD