ISR
Incremental Static Regeneration
Generated at
2026-09-17T13:16:43.273Z
How it works
- This page is prerendered like SSG, then allowed to refresh in the background (revalidate = 10 seconds).
- The first visitor after the 10s window still gets the stale HTML immediately. Next.js regenerates a new version in the background.
- The following request receives the new HTML. That is stale-while-revalidate.
- Use ISR for catalog/product pages: mostly static, but you want updates without a full rebuild.
How to test
- ISR only shows up in production: `npm run build && npm run start` in client/. In `next dev` every refresh looks like SSR.
- Open /isr and copy Generated at. Refresh immediately — it must stay the same (cache HIT).
- Wait at least 10 seconds, then refresh once. You may still see the old time (STALE) while Next.js rebuilds.
- Refresh again. The timestamp should jump to a newer time (new cache HIT).
- Run `curl -sI http://localhost:3000/isr` and watch x-nextjs-cache: HIT → STALE → HIT, and Cache-Control s-maxage=10.