From bda0cd27b3982d5173e4ad49e53aef1695380ec0 Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Sun, 25 Feb 2024 14:14:42 -0600 Subject: [PATCH] Change conditional generateStaticParams syntax --- src/app/p/[photoId]/layout.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/app/p/[photoId]/layout.tsx b/src/app/p/[photoId]/layout.tsx index 81004543..22d3557b 100644 --- a/src/app/p/[photoId]/layout.tsx +++ b/src/app/p/[photoId]/layout.tsx @@ -16,16 +16,16 @@ import { getPhotosNearIdCached } from '@/photo/cache'; import { getPhotoIds } from '@/services/vercel-postgres'; import { STATICALLY_OPTIMIZED } from '@/site/config'; -export async function generateStaticParams() { - if (STATICALLY_OPTIMIZED) { +const generateStaticParams = STATICALLY_OPTIMIZED + ? async () => { const photos = await getPhotoIds({ limit: GENERATE_STATIC_PARAMS_LIMIT }); return photos.map(photoId => ({ params: { photoId }, })); - } else { - return []; } -} + : undefined; + +export { generateStaticParams }; interface PhotoProps { params: { photoId: string }