Next.js Discord

Discord Forum

ISR but without deploy time cache / SSG?

Unanswered
Saltwater Crocodile posted this in #help-forum
Open in Discord
Saltwater CrocodileOP
* I'm using app router

Say I have a page, src/cool/page.tsx. I want this page to be cached for 3600, or one hour, before it is revalidated.

I might add export const revalidate = 3600; to this page.tsx file.

BUT, in my case I do NOT want a "cached" version of this page deployed at build / deploy time. The first time the page is requested I want it to rendered on the server and cached at that point, and from that point I'd like ISR to work as normal (e.g. stale version served while async request replaces static cache file on backend).

To put this another way, I want everything to work exactly as you'd expect it would with export const revalidate = 3600; on a page using the app router EXCEPT the static generation at deploy time.

Thanks for your advice / tips!

6 Replies

Barbary Lion
first idea that comes to my mind: use a postbuild script to revalidate all your pages
but anyways your build size will remain the same (if it is your problem)
at least i think that your build size will remain the same…
this is a good question I will come back to read other solutions
Saltwater CrocodileOP
Thanks toma, I appreciate it! ❤️
Saltwater CrocodileOP
I posted the question on reddit as well, but no bites 😦 - https://www.reddit.com/r/nextjs/comments/17hgafe/if_i_want_my_entire_site_to_use_isr_can_i_skip/