diff --git a/app/[page]/page.tsx b/app/[page]/page.tsx index 00e118f37..d2faf9760 100644 --- a/app/[page]/page.tsx +++ b/app/[page]/page.tsx @@ -5,7 +5,7 @@ import { notFound } from 'next/navigation'; export const runtime = 'edge'; -export const revalidate = 43200; // 12 hours in seconds +export const revalidate = parseInt(process.env.REVALIDATE_WINDOW ?? `${60 * 60 * 12}`); // 12 hours export async function generateMetadata({ params diff --git a/app/search/[collection]/page.tsx b/app/search/[collection]/page.tsx index 2012423c9..3f950b9d0 100644 --- a/app/search/[collection]/page.tsx +++ b/app/search/[collection]/page.tsx @@ -6,7 +6,6 @@ import Grid from 'components/grid'; import ProductGridItems from 'components/layout/product-grid-items'; export const runtime = 'edge'; -export const revalidate = 30; export async function generateMetadata({ params diff --git a/lib/medusa/index.ts b/lib/medusa/index.ts index f9ef38f90..3c1c54347 100644 --- a/lib/medusa/index.ts +++ b/lib/medusa/index.ts @@ -33,10 +33,13 @@ export default async function medusaRequest( headers: { 'Content-Type': 'application/json', 'x-publishable-key': MEDUSA_API_KEY - }, - next: { revalidate: REVALIDATE_WINDOW } + } }; + if (!path.includes('/carts')) { + options.next = { revalidate: REVALIDATE_WINDOW }; + } + if (payload) { options.body = JSON.stringify(payload); }