Performance: ISR (Incremental Static Regeneration)
MEDIUM IMPACT
ISR affects page load speed by serving static pages quickly while updating content in the background without blocking user requests.
export async function getStaticProps() { const res = await fetch('https://api.example.com/data'); const data = await res.json(); return { props: { data }, revalidate: 60 }; } // Page served statically and regenerated in background every 60 seconds
export async function getServerSideProps() { const res = await fetch('https://api.example.com/data'); const data = await res.json(); return { props: { data } }; } // Page renders on every request, blocking user until data loads
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Server-side rendering on every request | High (new DOM each request) | Multiple reflows per request | High paint cost due to delay | [X] Bad |
| ISR with revalidate option | Low (cached DOM reused) | Single reflow on initial load | Low paint cost, fast LCP | [OK] Good |