Stop caching individual queries on p/[photoId]

This commit is contained in:
Sam Becker 2024-04-20 20:08:15 -05:00
parent a76e2b88f7
commit e0110e00fc

View File

@ -12,9 +12,11 @@ import {
absolutePathForPhotoImage,
} from '@/site/paths';
import PhotoDetailPage from '@/photo/PhotoDetailPage';
import { getPhotoIds } from '@/services/vercel-postgres';
import { getPhotoIds, getPhotosNearId } from '@/services/vercel-postgres';
import { STATICALLY_OPTIMIZED } from '@/site/config';
import { getPhotosNearIdCachedCached } from '@/photo/cache';
import { cache } from 'react';
const getPhotosNearIdCached = cache(getPhotosNearId);
export let generateStaticParams:
(() => Promise<{ photoId: string }[]>) | undefined = undefined;
@ -33,7 +35,7 @@ interface PhotoProps {
export async function generateMetadata({
params: { photoId },
}:PhotoProps): Promise<Metadata> {
const { photo } = await getPhotosNearIdCachedCached(
const { photo } = await getPhotosNearIdCached(
photoId,
GRID_THUMBNAILS_TO_SHOW_MAX + 2,
);
@ -67,7 +69,7 @@ export default async function PhotoPage({
params: { photoId },
children,
}: PhotoProps & { children: React.ReactNode }) {
const { photos, photo } = await getPhotosNearIdCachedCached(
const { photos, photo } = await getPhotosNearIdCached(
photoId,
GRID_THUMBNAILS_TO_SHOW_MAX + 2,
);