Salman Amin
Salman Amin

Reputation: 82

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?

Upvotes: 6

Views: 4502

Answers (3)

Yap Kai Lun Leon
Yap Kai Lun Leon

Reputation: 326

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)

Upvotes: 2

Paul Wang
Paul Wang

Reputation: 276

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

Upvotes: 4

David B
David B

Reputation: 929

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)

Upvotes: 2

Related Questions