Change conditional generateStaticParams syntax

This commit is contained in:
Sam Becker 2024-02-25 14:14:42 -06:00
parent 31e5e263cf
commit bda0cd27b3

View File

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