From e802ab08b8438d47f1ff2257aea4399ccf2149b8 Mon Sep 17 00:00:00 2001 From: Emerson Laurentino Date: Thu, 17 Oct 2024 16:03:13 -0300 Subject: [PATCH] feat: Enable SWR delta and revalidate on page [slug]/p This commit enables the experimental feature "swrDelta" in the next.config.js file, which is used for optimizing data fetching with SWR. Additionally, it adds the "revalidate" option with a value of 300 seconds (5 minutes) in the getStaticProps function of the [slug]/p.tsx file. This option controls how often the page should be revalidated and updated with new data. --- packages/core/next.config.js | 1 + packages/core/src/pages/[slug]/p.tsx | 1 + 2 files changed, 2 insertions(+) diff --git a/packages/core/next.config.js b/packages/core/next.config.js index a680b48b69..52ea671041 100644 --- a/packages/core/next.config.js +++ b/packages/core/next.config.js @@ -23,6 +23,7 @@ const nextConfig = { }, // TODO: We won't need to enable this experimental feature when migrating to Next.js 13 experimental: { + swrDelta: 31536e3, scrollRestoration: true, /* * The FastStore Discovery CLI will update this value to match the path where the diff --git a/packages/core/src/pages/[slug]/p.tsx b/packages/core/src/pages/[slug]/p.tsx index daa5c76267..ff29652bf8 100644 --- a/packages/core/src/pages/[slug]/p.tsx +++ b/packages/core/src/pages/[slug]/p.tsx @@ -263,6 +263,7 @@ export const getStaticProps: GetStaticProps< globalSections, key: seo.canonical, }, + revalidate: 3e2, } }