diff --git a/examples/cms-datocms/pages/index.js b/examples/cms-datocms/pages/index.js index e789b602ee15a88..736ad6121294567 100644 --- a/examples/cms-datocms/pages/index.js +++ b/examples/cms-datocms/pages/index.js @@ -36,7 +36,7 @@ export default function Index({ allPosts }) { } export async function getStaticProps({ preview }) { - const allPosts = await getAllPostsForHome(preview) + const allPosts = await getAllPostsForHome(preview) || [] return { props: { allPosts }, } diff --git a/examples/cms-datocms/pages/posts/[slug].js b/examples/cms-datocms/pages/posts/[slug].js index bcfa6683eec7ee0..d00288b803ee2ea 100644 --- a/examples/cms-datocms/pages/posts/[slug].js +++ b/examples/cms-datocms/pages/posts/[slug].js @@ -50,7 +50,7 @@ export default function Post({ post, morePosts, preview }) { ) } -export async function getStaticProps({ params, preview }) { +export async function getStaticProps({ params, preview = null }) { const data = await getPostAndMorePosts(params.slug, preview) const content = await markdownToHtml(data?.post?.content || '')