Support for max-age
Parameter in Incremental Static Regeneration (ISR)
#66086
Strahbehry
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Goals
Non-Goals
Background
Incremental Static Regeneration (ISR) in Next.js allows developers to revalidate static pages at specified intervals. However, this can lead to scenarios where the first user after the revalidation period receives stale data until the revalidation completes. This is particularly problematic for time-sensitive content such as news or event updates. Currently, there is no built-in mechanism to enforce a maximum age for static pages, which can result in users seeing outdated information.
Adding a
max-age
parameter would allow developers to specify the maximum allowable age for static content, ensuring that no user ever receives content older than a certain duration. This feature would enhance the flexibility and reliability of ISR, aligning with the goals of providing a seamless developer and user experience.Proposal
Extend the getStaticProps return object to accept a maxAge parameter alongside revalidate.
Revalidation Logic:
Enhance the ISR mechanism to check both the revalidate interval and the maxAge value. If the page exceeds the maxAge, it should be revalidated immediately, even if it hasn't been requested by a user.
Background Revalidation:
Implement background processes or hooks within Next.js to periodically check the age of static pages and trigger revalidation as needed based on the maxAge parameter.
Sadly my knowledge of the internal workings of Next JS are limited so I would not be an effective contributor.
Beta Was this translation helpful? Give feedback.
All reactions