mirror of
https://github.com/vercel/commerce.git
synced 2025-06-29 18:01:21 +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 });
|
const page = await getAgilityPageProps({ preview, params, locale });
|
||||||
|
|
||||||
|
let rebuildFrequency = 10
|
||||||
|
|
||||||
if (productCode) {
|
if (productCode) {
|
||||||
const config = getConfig({ locale })
|
const config = getConfig({ locale })
|
||||||
const { product } = await getProduct({
|
const { product } = await getProduct({
|
||||||
@ -44,6 +46,7 @@ export async function getStaticProps({ preview, params, locale }: GetStaticProps
|
|||||||
|
|
||||||
if (product !== null) {
|
if (product !== null) {
|
||||||
page.dynamicPageItem = product
|
page.dynamicPageItem = product
|
||||||
|
rebuildFrequency = 60 * 60 //once per hour for products
|
||||||
} else {
|
} else {
|
||||||
throw new Error(`Product not found`)
|
throw new Error(`Product not found`)
|
||||||
}
|
}
|
||||||
@ -58,7 +61,7 @@ export async function getStaticProps({ preview, params, locale }: GetStaticProps
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
props: { ...defaultPageProps, pages, page },
|
props: { ...defaultPageProps, pages, page },
|
||||||
revalidate: 60 * 60, // Every hour
|
revalidate: rebuildFrequency
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user