5

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?

Salman Amin
  • 78
  • 1
  • 7

3 Answers3

4

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

Paul Wang
  • 266
  • 1
  • 5
  • 14
  • 2
    Please refer to the comment above, there is out of the box functionality for this now in 12.1 – David B Mar 23 '22 at 15:24
2

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)

David B
  • 889
  • 2
  • 11
  • 29
1

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)