Revert generateStaticParams behavior

This commit is contained in:
Sam Becker 2024-02-28 16:28:03 -06:00
parent 541cd748cf
commit ceb9cc50b4

View File

@ -14,13 +14,19 @@ import {
import PhotoDetailPage from '@/photo/PhotoDetailPage';
import { getPhotosNearIdCached } from '@/photo/cache';
import { getPhotoIds } from '@/services/vercel-postgres';
import { STATICALLY_OPTIMIZED } from '@/site/config';
export const generateStaticParams = async () => {
const photos = await getPhotoIds({ limit: GENERATE_STATIC_PARAMS_LIMIT });
return photos.map(photoId => ({
params: { photoId },
}));
};
export let generateStaticParams:
(() => Promise<{ params: { photoId: string } }[]>) | undefined = undefined;
if (STATICALLY_OPTIMIZED) {
generateStaticParams = async () => {
const photos = await getPhotoIds({ limit: GENERATE_STATIC_PARAMS_LIMIT });
return photos.map(photoId => ({
params: { photoId },
}));
};
}
interface PhotoProps {
params: { photoId: string }