Skip to content

Commit

Permalink
feat: Enable SWR delta and revalidate on page [slug]/p
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
emersonlaurentino committed Oct 17, 2024
1 parent 0666c16 commit e802ab0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/core/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/pages/[slug]/p.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ export const getStaticProps: GetStaticProps<
globalSections,
key: seo.canonical,
},
revalidate: 3e2,
}
}

Expand Down

0 comments on commit e802ab0

Please sign in to comment.