Question presented to candidate: "Our blog has 20,000 posts. Rebuilding everything on each publish takes too long, and rendering every request is too expensive. How does ISR help, and how do you set it up?"
What a strong answer should cover:
- ISR keeps a page static (prerendered, served from storage) but lets it be regenerated after deploy, without a rebuild.
- Time-based:
export const revalidate = non the route, ornext: { revalidate: n }on a fetch. - It is stale-while-revalidate: the first request after expiry still gets the old page and triggers a regeneration in the background.
- On-demand:
revalidatePathorrevalidateTagmark content stale from a Server Action or webhook. - Pages not listed in
generateStaticParamscan be generated on first request and then cached, which is how ISR scales to many pages.
Clarifying questions expected:
- "How stale may a post be after an edit?" β decides between time-based and on-demand.
- "How many pages are there?" β decides how many to prerender at build time.
Code / implementation expected: Yes β a route with a revalidate time and a partial generateStaticParams list.