From 1ffff2b6f6861ad560541c60adfeb16d1cd4016b Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Wed, 8 May 2024 13:10:47 -0500 Subject: [PATCH] Only statically optimize in production --- src/app/p/[photoId]/image/route.tsx | 2 +- src/app/p/[photoId]/layout.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/p/[photoId]/image/route.tsx b/src/app/p/[photoId]/image/route.tsx index 9ff57e29..1852553e 100644 --- a/src/app/p/[photoId]/image/route.tsx +++ b/src/app/p/[photoId]/image/route.tsx @@ -11,7 +11,7 @@ import { isNextImageReadyBasedOnPhotos } from '@/photo'; export let generateStaticParams: (() => Promise<{ photoId: string }[]>) | undefined = undefined; -if (STATICALLY_OPTIMIZED_OG_IMAGES) { +if (STATICALLY_OPTIMIZED_OG_IMAGES && process.env.NODE_ENV === 'production') { generateStaticParams = async () => { const photos = await getPhotoIds({ limit: GENERATE_STATIC_PARAMS_LIMIT }); return photos.map(photoId => ({ photoId })); diff --git a/src/app/p/[photoId]/layout.tsx b/src/app/p/[photoId]/layout.tsx index 20380d6e..9f353933 100644 --- a/src/app/p/[photoId]/layout.tsx +++ b/src/app/p/[photoId]/layout.tsx @@ -18,7 +18,7 @@ import { GENERATE_STATIC_PARAMS_LIMIT, getPhotoIds } from '@/photo/db'; export let generateStaticParams: (() => Promise<{ photoId: string }[]>) | undefined = undefined; -if (STATICALLY_OPTIMIZED_PAGES) { +if (STATICALLY_OPTIMIZED_PAGES && process.env.NODE_ENV === 'production') { generateStaticParams = async () => { const photos = await getPhotoIds({ limit: GENERATE_STATIC_PARAMS_LIMIT }); return photos.map(photoId => ({ photoId }));