diff --git a/src/app/film/[simulation]/[photoId]/layout.tsx b/src/app/film/[simulation]/[photoId]/layout.tsx index 30367832..63107a59 100644 --- a/src/app/film/[simulation]/[photoId]/layout.tsx +++ b/src/app/film/[simulation]/[photoId]/layout.tsx @@ -11,10 +11,13 @@ import { } from '@/site/paths'; import PhotoDetailPage from '@/photo/PhotoDetailPage'; import { getPhotoCached } from '@/photo/cache'; -import { ReactNode } from 'react'; +import { ReactNode, cache } from 'react'; import { FilmSimulation } from '@/simulation'; import { getPhotosFilmSimulationDataCached } from '@/simulation/data'; +export const getPhotoCachedCached = + cache((photoId: string) => getPhotoCached(photoId)); + interface PhotoFilmSimulationProps { params: { photoId: string, simulation: FilmSimulation } } @@ -22,7 +25,7 @@ interface PhotoFilmSimulationProps { export async function generateMetadata({ params: { photoId, simulation }, }: PhotoFilmSimulationProps): Promise { - const photo = await getPhotoCached(photoId); + const photo = await getPhotoCachedCached(photoId); if (!photo) { return {}; } @@ -53,7 +56,7 @@ export default async function PhotoFilmSimulationPage({ params: { photoId, simulation }, children, }: PhotoFilmSimulationProps & { children: ReactNode }) { - const photo = await getPhotoCached(photoId); + const photo = await getPhotoCachedCached(photoId); if (!photo) { redirect(PATH_ROOT); }