Replies: 4 comments 8 replies
-
Ow I had to wait for a bit longer. I guess it takes a bit of time to regenerate the page? |
Beta Was this translation helpful? Give feedback.
-
It seems that pages that implement |
Beta Was this translation helpful? Give feedback.
-
I'm experiencing an issue with pages that are generated at build time are not revalidated. For instance, this does not regenerate the page when changes are made in the CMS: /**
* Initial Props
*/
export const getStaticProps: GetStaticProps = async (ctx) => {
const { params } = ctx
if (!params) return { props: { product: undefined } }
const variables = { handle: params.productSlug }
const response = await request<Response>(productQuery, variables)
const products = response?.allShopifyProduct
const product = products && products.length ? products[0] : null
return { props: { product }, unstable_revalidate: 1 }
}
/**
* Static Paths
*/
const pageHandlesQuery = gql`
query ProductHandlesQuery {
allShopifyProduct {
_id
shopifyId
handle
}
}
`
export const getStaticPaths: GetStaticPaths = async () => {
const result = await request<Response>(pageHandlesQuery)
const products = definitely(result?.allShopifyProduct)
const paths = products.map((product) => ({
params: { productSlug: product.handle ? product.handle : undefined },
}))
return {
paths,
fallback: true,
}
} But this does: /**
* Initial Props
*/
export const getStaticProps: GetStaticProps = async (ctx) => {
const { params } = ctx
if (!params) return { props: { product: undefined } }
const variables = { handle: params.productSlug }
const response = await request<Response>(productQuery, variables)
const products = response?.allShopifyProduct
const product = products && products.length ? products[0] : null
return { props: { product }, unstable_revalidate: 1 }
}
/**
* Static Paths
*/
export const getStaticPaths: GetStaticPaths = async () => {
return {
paths: [],
fallback: true,
}
} It's the same behavior on the final example in this blog post: https://arunoda.me/blog/what-is-nextjs-issg Is this how the feature is supposed to work? |
Beta Was this translation helpful? Give feedback.
-
For future reference I have created a demo of various combinations of
It is deployed https://next-analysis-onb37tfno.vercel.app/ for people to play with |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
So I was trying out the unstable_revalidate property and deployed it:
However I don't see the statically generated page being updated. I can check this via the timestamp which is being fetched.
https://static-next.willemliu.now.sh/ssg/static-generated
Edit (2020-05-14):
It seems that pages that implement
getStaticProps
withoutgetStaticPaths
will not be regenerated when using theunstable_revalidate
option.Beta Was this translation helpful? Give feedback.
All reactions