From 9db85f5944624e7609c92c844221ae0cb40333d3 Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Wed, 20 Sep 2023 14:58:09 -0500 Subject: [PATCH] Revert to non-static edge functions --- src/app/(static)/grid/page.tsx | 3 +-- src/app/(static)/p/[photoId]/layout.tsx | 11 +---------- src/app/(static)/page.tsx | 3 +-- 3 files changed, 3 insertions(+), 14 deletions(-) diff --git a/src/app/(static)/grid/page.tsx b/src/app/(static)/grid/page.tsx index 39f7b2dd..73af56ec 100644 --- a/src/app/(static)/grid/page.tsx +++ b/src/app/(static)/grid/page.tsx @@ -8,8 +8,7 @@ import { getPhotos, getPhotosCount, getUniqueTags } from '@/services/postgres'; import PhotoTag from '@/tag/PhotoTag'; import { Metadata } from 'next'; -// Revalidate every 12 hours -export const revalidate = 43_200; +export const runtime = 'edge'; export async function generateMetadata(): Promise { const photos = await getPhotos(); diff --git a/src/app/(static)/p/[photoId]/layout.tsx b/src/app/(static)/p/[photoId]/layout.tsx index 25e815cf..daa2200a 100644 --- a/src/app/(static)/p/[photoId]/layout.tsx +++ b/src/app/(static)/p/[photoId]/layout.tsx @@ -6,7 +6,6 @@ import { import { Metadata } from 'next'; import { getPhoto, - getPhotos, getPhotosTakenAfterPhotoInclusive, getPhotosTakenBeforePhoto, } from '@/services/postgres'; @@ -14,15 +13,7 @@ import { redirect } from 'next/navigation'; import { absolutePathForPhoto, absolutePathForPhotoImage } from '@/site/paths'; import PhotoDetailPage from '@/photo/PhotoDetailPage'; -// Revalidate every 12 hours -export const revalidate = 43_200; - -export async function generateStaticParams() { - const photos = await getPhotos(); - return photos.map(photo => ({ - slug: photo.id, - })); -} +export const runtime = 'edge'; export async function generateMetadata({ params: { photoId }, diff --git a/src/app/(static)/page.tsx b/src/app/(static)/page.tsx index 2dc3e294..22ccedd0 100644 --- a/src/app/(static)/page.tsx +++ b/src/app/(static)/page.tsx @@ -7,8 +7,7 @@ import PhotosEmptyState from '@/photo/PhotosEmptyState'; import { getPhotos, getPhotosCount } from '@/services/postgres'; import { Metadata } from 'next'; -// Revalidate every 12 hours -export const revalidate = 43_200; +export const runtime = 'edge'; export async function generateMetadata(): Promise { const photos = await getPhotos();