mirror of
https://github.com/vercel/commerce.git
synced 2025-05-19 07:56:59 +00:00
rebuild every 10 seconds on agility pages
This commit is contained in:
parent
3906917161
commit
c7a8dbdf87
@ -34,6 +34,8 @@ export async function getStaticProps({ preview, params, locale }: GetStaticProps
|
||||
|
||||
const page = await getAgilityPageProps({ preview, params, locale });
|
||||
|
||||
let rebuildFrequency = 10
|
||||
|
||||
if (productCode) {
|
||||
const config = getConfig({ locale })
|
||||
const { product } = await getProduct({
|
||||
@ -44,6 +46,7 @@ export async function getStaticProps({ preview, params, locale }: GetStaticProps
|
||||
|
||||
if (product !== null) {
|
||||
page.dynamicPageItem = product
|
||||
rebuildFrequency = 60 * 60 //once per hour for products
|
||||
} else {
|
||||
throw new Error(`Product not found`)
|
||||
}
|
||||
@ -58,7 +61,7 @@ export async function getStaticProps({ preview, params, locale }: GetStaticProps
|
||||
|
||||
return {
|
||||
props: { ...defaultPageProps, pages, page },
|
||||
revalidate: 60 * 60, // Every hour
|
||||
revalidate: rebuildFrequency
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user