Fix generateStaticParams bug

This commit is contained in:
Sam Becker 2024-04-18 23:29:25 -05:00
parent 252aa83d70
commit 0d92ff0204
2 changed files with 3 additions and 6 deletions

View File

@ -71,8 +71,7 @@ export default function RootLayout({
return (
<html
lang="en"
// Suppress hydration errors due to
// next-themes behavior
// Suppress hydration errors due to next-themes behavior
suppressHydrationWarning
>
<body className={ibmPlexMono.variable}>

View File

@ -17,14 +17,12 @@ import { STATICALLY_OPTIMIZED } from '@/site/config';
import { getPhotosNearIdCachedCached } from '@/photo/cache';
export let generateStaticParams:
(() => Promise<{ params: { photoId: string } }[]>) | undefined = undefined;
(() => Promise<{ photoId: string }[]>) | undefined = undefined;
if (STATICALLY_OPTIMIZED) {
generateStaticParams = async () => {
const photos = await getPhotoIds({ limit: GENERATE_STATIC_PARAMS_LIMIT });
return photos.map(photoId => ({
params: { photoId },
}));
return photos.map(photoId => ({ photoId }));
};
}