Fix generateStaticParams bug
This commit is contained in:
parent
252aa83d70
commit
0d92ff0204
@ -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}>
|
||||
|
||||
@ -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 }));
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user