From 1e6f517515055fa60c432272f38a37d87a5a5f83 Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Mon, 22 Jan 2024 09:04:41 -0600 Subject: [PATCH] Temporarily remove caching from [photoId] --- src/app/p/[photoId]/image/route.tsx | 5 +++-- src/app/p/[photoId]/layout.tsx | 12 ++++++++---- src/app/p/[photoId]/share/page.tsx | 4 ++-- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/app/p/[photoId]/image/route.tsx b/src/app/p/[photoId]/image/route.tsx index 4a9d963a..01ab1df0 100644 --- a/src/app/p/[photoId]/image/route.tsx +++ b/src/app/p/[photoId]/image/route.tsx @@ -1,8 +1,9 @@ // import { auth } from '@/auth'; // import { getImageCacheHeadersForAuth, getPhotoCached } from '@/cache'; -import { getPhotoCached } from '@/cache'; +// import { getPhotoCached } from '@/cache'; import { IMAGE_OG_DIMENSION } from '@/photo/image-response'; import PhotoImageResponse from '@/photo/image-response/PhotoImageResponse'; +import { getPhoto } from '@/services/vercel-postgres'; import { getIBMPlexMonoMedium } from '@/site/font'; import { ImageResponse } from 'next/og'; @@ -17,7 +18,7 @@ export async function GET( { fontFamily, fonts }, // headers, ] = await Promise.all([ - getPhotoCached(context.params.photoId), + getPhoto(context.params.photoId), getIBMPlexMonoMedium(), // getImageCacheHeadersForAuth(await auth()), ]); diff --git a/src/app/p/[photoId]/layout.tsx b/src/app/p/[photoId]/layout.tsx index 8e8e75a5..69db9114 100644 --- a/src/app/p/[photoId]/layout.tsx +++ b/src/app/p/[photoId]/layout.tsx @@ -12,8 +12,12 @@ import { absolutePathForPhotoImage, } from '@/site/paths'; import PhotoDetailPage from '@/photo/PhotoDetailPage'; -import { getPhotoCached, getPhotosNearIdCached } from '@/cache'; -import { getPhotoIds } from '@/services/vercel-postgres'; +// import { getPhotoCached, getPhotosNearIdCached } from '@/cache'; +import { + getPhoto, + getPhotoIds, + getPhotosNearId, +} from '@/services/vercel-postgres'; export async function generateStaticParams() { const photos = await getPhotoIds({ limit: 10 }); @@ -27,7 +31,7 @@ interface PhotoProps { export async function generateMetadata({ params: { photoId }, }:PhotoProps): Promise { - const photo = await getPhotoCached(photoId); + const photo = await getPhoto(photoId); if (!photo) { return {}; } @@ -58,7 +62,7 @@ export default async function PhotoPage({ params: { photoId }, children, }: PhotoProps & { children: React.ReactNode }) { - const photos = await getPhotosNearIdCached( + const photos = await getPhotosNearId( photoId, GRID_THUMBNAILS_TO_SHOW_MAX + 2, ); diff --git a/src/app/p/[photoId]/share/page.tsx b/src/app/p/[photoId]/share/page.tsx index fff8c1ba..b62cba08 100644 --- a/src/app/p/[photoId]/share/page.tsx +++ b/src/app/p/[photoId]/share/page.tsx @@ -1,5 +1,5 @@ -import { getPhotoCached } from '@/cache'; import PhotoShareModal from '@/photo/PhotoShareModal'; +import { getPhoto } from '@/services/vercel-postgres'; import { PATH_ROOT } from '@/site/paths'; import { redirect } from 'next/navigation'; @@ -8,7 +8,7 @@ export default async function Share({ }: { params: { photoId: string } }) { - const photo = await getPhotoCached(photoId); + const photo = await getPhoto(photoId); if (!photo) { return redirect(PATH_ROOT); }