From c3a58ce4242bd8f06cee0787c9552a4e5699ee44 Mon Sep 17 00:00:00 2001 From: Sam Carlton Date: Sat, 11 Sep 2021 15:44:56 -0500 Subject: [PATCH] Add revalidate to static props --- pages/formula/[...slug].js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/pages/formula/[...slug].js b/pages/formula/[...slug].js index 8fc08f0..b537e5e 100644 --- a/pages/formula/[...slug].js +++ b/pages/formula/[...slug].js @@ -22,11 +22,17 @@ export async function getStaticPaths() { } } +const ONE_MINUTE = 60 + +const defaultStaticProps = { + revalidate: ONE_MINUTE +} + export async function getStaticProps({ params }) { const { slug } = params // if (slug.length > 40 || !TWEET_ID.test(tweet)) { - // return { notFound: true }; + // return { notFound: true, ...defaultStaticProps }; // } try { @@ -57,7 +63,10 @@ export async function getStaticProps({ params }) { console.log('pageListing', pageListing) - return pageListing ? { props: pageListing } : { notFound: true } + return pageListing ? { + props: pageListing, + ...defaultStaticProps + } : { notFound: true } } catch (error) { // The Twitter API most likely died console.error(error)