简体   繁体   中英

Next.js ISR ( Incremental Static Regeneration ), how to rebuild or update a specific page manually or dynamically before the interval/ISR time start?

In NextJS Production mode - In Incremental Static Regeneration, I have placed an auto revalidate interval to 604800 seconds(7 days). In the meantime I may need to update a specific page before the interval time start.

How can I rebuild/update a specific page without rebuilding the full site before the interval/ISR time start?

currently next.js doesn't have a native feature for rebuilding a static page manually.

here is a workaround you can refer to.

and next.js team is actively working on this topic, you can refer to this RFC

2022/04/07 update

on-demand-isr is in beta

https://nextjs.org/blog/next-12-1#on-demand-incremental-static-regeneration-beta

This is now possible in Next.js v12.1.

I saw this feature in the 12.1 release notes, it allows a manual cache purge for a page, on demand. using the unstable_revalidate() function.

I haven't tested it yet though but hope this helps.

On Demand Incremental Static Regeneration (beta)

The feature is available and stable now. I have done a simple test and created a module for it. It should solve the problem you have.

On-Demand Incremental Static Regeneration (Stable)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM