From 1d83ea40429e5e553921c462bc1ea9184aa6988e Mon Sep 17 00:00:00 2001 From: Sol Irvine Date: Sun, 8 Oct 2023 21:20:35 +0900 Subject: [PATCH] add revalidation timeframes --- app/[locale]/about/page.tsx | 2 ++ app/[locale]/page.tsx | 2 ++ app/[locale]/product/[handle]/layout.tsx | 2 ++ app/[locale]/product/[handle]/page.tsx | 2 +- app/[locale]/products/page.tsx | 2 +- app/[locale]/shop-list/opengraph-image.tsx | 1 + app/[locale]/shop-list/page.tsx | 3 +-- app/[locale]/stories/[handle]/layout.tsx | 2 ++ app/[locale]/stories/[handle]/page.tsx | 2 ++ app/[locale]/stories/page.tsx | 2 ++ app/[locale]/terms/page.tsx | 2 ++ deprecated/[page]/opengraph-image.tsx | 1 + deprecated/[page]/page.tsx | 3 +-- deprecated/search/[collection]/opengraph-image.tsx | 1 + deprecated/search/[collection]/page.tsx | 1 + deprecated/search/page.tsx | 1 + 16 files changed, 23 insertions(+), 6 deletions(-) diff --git a/app/[locale]/about/page.tsx b/app/[locale]/about/page.tsx index 936d6628d..1fcfbe8b1 100644 --- a/app/[locale]/about/page.tsx +++ b/app/[locale]/about/page.tsx @@ -9,6 +9,8 @@ import { Suspense } from 'react'; import AboutNaraiDetail from './about-narai-detail'; export const runtime = 'edge'; +export const revalidate = 43200; // 12 hours in seconds + const { SITE_NAME } = process.env; export const metadata = { diff --git a/app/[locale]/page.tsx b/app/[locale]/page.tsx index 68e1736fb..d351d6034 100644 --- a/app/[locale]/page.tsx +++ b/app/[locale]/page.tsx @@ -27,6 +27,8 @@ import Image from 'next/image'; import { Suspense } from 'react'; export const runtime = 'edge'; +export const revalidate = 300; // 5 minutes in seconds + const { SITE_NAME } = process.env; export const metadata = { diff --git a/app/[locale]/product/[handle]/layout.tsx b/app/[locale]/product/[handle]/layout.tsx index a9aebb272..9d1928993 100644 --- a/app/[locale]/product/[handle]/layout.tsx +++ b/app/[locale]/product/[handle]/layout.tsx @@ -7,6 +7,8 @@ import { cookies } from 'next/headers'; import { ReactNode, Suspense } from 'react'; export const runtime = 'edge'; +export const revalidate = 300; // 5 minutes in seconds + const { SITE_NAME } = process.env; export const metadata = { diff --git a/app/[locale]/product/[handle]/page.tsx b/app/[locale]/product/[handle]/page.tsx index 6475e6382..01b6330bb 100644 --- a/app/[locale]/product/[handle]/page.tsx +++ b/app/[locale]/product/[handle]/page.tsx @@ -19,7 +19,7 @@ import Image from 'next/image'; import Link from 'next/link'; export const runtime = 'edge'; -export const revalidate = 43200; // 12 hours in seconds +export const revalidate = 300; // 5 minutes in seconds export async function generateMetadata({ params diff --git a/app/[locale]/products/page.tsx b/app/[locale]/products/page.tsx index e013e14c4..3993cfa35 100644 --- a/app/[locale]/products/page.tsx +++ b/app/[locale]/products/page.tsx @@ -9,7 +9,7 @@ import { cookies } from 'next/headers'; import { Suspense } from 'react'; export const runtime = 'edge'; -export const revalidate = 43200; // 12 hours in seconds +export const revalidate = 300; // 5 minutes in seconds const { SITE_NAME } = process.env; diff --git a/app/[locale]/shop-list/opengraph-image.tsx b/app/[locale]/shop-list/opengraph-image.tsx index 8f068a6f1..df924a4a3 100644 --- a/app/[locale]/shop-list/opengraph-image.tsx +++ b/app/[locale]/shop-list/opengraph-image.tsx @@ -2,6 +2,7 @@ import OpengraphImage from 'components/opengraph-image'; import { getPage } from 'lib/shopify'; export const runtime = 'edge'; +export const revalidate = 300; // 5 minutes in seconds export default async function Image({ params }: { params: { page: string } }) { const page = await getPage({ handle: params.page }); diff --git a/app/[locale]/shop-list/page.tsx b/app/[locale]/shop-list/page.tsx index 0f63e9b6c..0a14091bf 100644 --- a/app/[locale]/shop-list/page.tsx +++ b/app/[locale]/shop-list/page.tsx @@ -12,8 +12,7 @@ import { Suspense } from 'react'; import ShopsNav from './shops-nav'; export const runtime = 'edge'; - -export const revalidate = 43200; // 12 hours in seconds +export const revalidate = 300; // 5 minutes in seconds export async function generateMetadata({ params diff --git a/app/[locale]/stories/[handle]/layout.tsx b/app/[locale]/stories/[handle]/layout.tsx index 5916e25a2..747ed671a 100644 --- a/app/[locale]/stories/[handle]/layout.tsx +++ b/app/[locale]/stories/[handle]/layout.tsx @@ -8,6 +8,8 @@ import { cookies } from 'next/headers'; import { ReactNode, Suspense } from 'react'; export const runtime = 'edge'; +export const revalidate = 300; // 5 minutes in seconds + const { SITE_NAME } = process.env; export const metadata = { diff --git a/app/[locale]/stories/[handle]/page.tsx b/app/[locale]/stories/[handle]/page.tsx index d9a9c1730..0dc20e721 100644 --- a/app/[locale]/stories/[handle]/page.tsx +++ b/app/[locale]/stories/[handle]/page.tsx @@ -7,7 +7,9 @@ import { BLOG_HANDLE, HIDDEN_ARTICLE_TAG } from 'lib/constants'; import { getBlogArticle } from 'lib/shopify'; import { BlogArticle } from 'lib/shopify/types'; import Image from 'next/image'; + export const runtime = 'edge'; +export const revalidate = 300; // 5 minutes in seconds export async function generateMetadata({ params diff --git a/app/[locale]/stories/page.tsx b/app/[locale]/stories/page.tsx index bf8545d2b..316d20c0a 100644 --- a/app/[locale]/stories/page.tsx +++ b/app/[locale]/stories/page.tsx @@ -10,6 +10,8 @@ import { cookies } from 'next/headers'; import { Suspense } from 'react'; export const runtime = 'edge'; +export const revalidate = 300; // 5 minutes in seconds + const { SITE_NAME } = process.env; export const metadata = { diff --git a/app/[locale]/terms/page.tsx b/app/[locale]/terms/page.tsx index 04339f352..fcd3b8647 100644 --- a/app/[locale]/terms/page.tsx +++ b/app/[locale]/terms/page.tsx @@ -9,6 +9,8 @@ import { Suspense } from 'react'; import TermsOfUse from './terms-of-use'; export const runtime = 'edge'; +export const revalidate = 43200; // 12 hours in seconds + const { SITE_NAME } = process.env; export const metadata = { diff --git a/deprecated/[page]/opengraph-image.tsx b/deprecated/[page]/opengraph-image.tsx index 8f068a6f1..df924a4a3 100644 --- a/deprecated/[page]/opengraph-image.tsx +++ b/deprecated/[page]/opengraph-image.tsx @@ -2,6 +2,7 @@ import OpengraphImage from 'components/opengraph-image'; import { getPage } from 'lib/shopify'; export const runtime = 'edge'; +export const revalidate = 300; // 5 minutes in seconds export default async function Image({ params }: { params: { page: string } }) { const page = await getPage({ handle: params.page }); diff --git a/deprecated/[page]/page.tsx b/deprecated/[page]/page.tsx index ae5238781..b45893f16 100644 --- a/deprecated/[page]/page.tsx +++ b/deprecated/[page]/page.tsx @@ -5,8 +5,7 @@ import Prose from 'components/prose'; import { getPage } from 'lib/shopify'; import { notFound } from 'next/navigation'; -// export const runtime = 'edge'; - +export const runtime = 'edge'; export const revalidate = 43200; // 12 hours in seconds export async function generateMetadata({ diff --git a/deprecated/search/[collection]/opengraph-image.tsx b/deprecated/search/[collection]/opengraph-image.tsx index 969a652b1..bdeb12cc8 100644 --- a/deprecated/search/[collection]/opengraph-image.tsx +++ b/deprecated/search/[collection]/opengraph-image.tsx @@ -2,6 +2,7 @@ import OpengraphImage from 'components/opengraph-image'; import { getCollection } from 'lib/shopify'; export const runtime = 'edge'; +export const revalidate = 300; // 5 minutes in seconds export default async function Image({ params }: { params: { collection: string } }) { const collection = await getCollection({ handle: params.collection }); diff --git a/deprecated/search/[collection]/page.tsx b/deprecated/search/[collection]/page.tsx index 1698a0930..8238ca8b7 100644 --- a/deprecated/search/[collection]/page.tsx +++ b/deprecated/search/[collection]/page.tsx @@ -7,6 +7,7 @@ import ProductGridItems from 'components/layout/product-grid-items'; import { defaultSort, sorting } from 'lib/constants'; export const runtime = 'edge'; +export const revalidate = 300; // 5 minutes in seconds export async function generateMetadata({ params diff --git a/deprecated/search/page.tsx b/deprecated/search/page.tsx index 2f7a53bd4..d979df49d 100644 --- a/deprecated/search/page.tsx +++ b/deprecated/search/page.tsx @@ -4,6 +4,7 @@ import { defaultSort, sorting } from 'lib/constants'; import { getProducts } from 'lib/shopify'; export const runtime = 'edge'; +export const revalidate = 300; // 5 minutes in seconds export const metadata = { title: 'Search',