Undo static generation debugging
This commit is contained in:
parent
1e6f517515
commit
861c6377b2
@ -1,9 +1,7 @@
|
||||
// import { auth } from '@/auth';
|
||||
// import { getImageCacheHeadersForAuth, getPhotoCached } from '@/cache';
|
||||
// import { getPhotoCached } from '@/cache';
|
||||
import { auth } from '@/auth';
|
||||
import { getImageCacheHeadersForAuth, 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';
|
||||
|
||||
@ -18,9 +16,9 @@ export async function GET(
|
||||
{ fontFamily, fonts },
|
||||
// headers,
|
||||
] = await Promise.all([
|
||||
getPhoto(context.params.photoId),
|
||||
getPhotoCached(context.params.photoId),
|
||||
getIBMPlexMonoMedium(),
|
||||
// getImageCacheHeadersForAuth(await auth()),
|
||||
getImageCacheHeadersForAuth(await auth()),
|
||||
]);
|
||||
|
||||
if (!photo) { return new Response('Photo not found', { status: 404 }); }
|
||||
|
||||
@ -12,12 +12,8 @@ import {
|
||||
absolutePathForPhotoImage,
|
||||
} from '@/site/paths';
|
||||
import PhotoDetailPage from '@/photo/PhotoDetailPage';
|
||||
// import { getPhotoCached, getPhotosNearIdCached } from '@/cache';
|
||||
import {
|
||||
getPhoto,
|
||||
getPhotoIds,
|
||||
getPhotosNearId,
|
||||
} from '@/services/vercel-postgres';
|
||||
import { getPhotoCached, getPhotosNearIdCached } from '@/cache';
|
||||
import { getPhotoIds } from '@/services/vercel-postgres';
|
||||
|
||||
export async function generateStaticParams() {
|
||||
const photos = await getPhotoIds({ limit: 10 });
|
||||
@ -31,7 +27,7 @@ interface PhotoProps {
|
||||
export async function generateMetadata({
|
||||
params: { photoId },
|
||||
}:PhotoProps): Promise<Metadata> {
|
||||
const photo = await getPhoto(photoId);
|
||||
const photo = await getPhotoCached(photoId);
|
||||
|
||||
if (!photo) { return {}; }
|
||||
|
||||
@ -62,7 +58,7 @@ export default async function PhotoPage({
|
||||
params: { photoId },
|
||||
children,
|
||||
}: PhotoProps & { children: React.ReactNode }) {
|
||||
const photos = await getPhotosNearId(
|
||||
const photos = await getPhotosNearIdCached(
|
||||
photoId,
|
||||
GRID_THUMBNAILS_TO_SHOW_MAX + 2,
|
||||
);
|
||||
@ -74,7 +70,7 @@ export default async function PhotoPage({
|
||||
const isPhotoFirst = photos.findIndex(p => p.id === photoId) === 0;
|
||||
|
||||
// Warm OG image without waiting on response
|
||||
// fetch(absolutePathForPhotoImage(photo));
|
||||
fetch(absolutePathForPhotoImage(photo));
|
||||
|
||||
return <>
|
||||
{children}
|
||||
|
||||
@ -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 getPhoto(photoId);
|
||||
const photo = await getPhotoCached(photoId);
|
||||
|
||||
if (!photo) { return redirect(PATH_ROOT); }
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user