Performance: Full route cache
HIGH IMPACT
Full route cache improves page load speed by serving pre-rendered pages instantly, reducing server work and network delays.
export async function getStaticProps() { const res = await fetch('https://api.example.com/data'); const data = await res.json(); return { props: { data }, revalidate: 3600 }; } export default function Page({ data }) { return <div>{data.content}</div>; }
export async function getServerSideProps() { const res = await fetch('https://api.example.com/data'); const data = await res.json(); return { props: { data } }; } export default function Page({ data }) { return <div>{data.content}</div>; }
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Server-side rendering on every request | Moderate (depends on data) | Multiple reflows due to delayed content | High paint cost due to slow content arrival | [X] Bad |
| Static generation with full route cache | Minimal (pre-rendered HTML) | Single reflow on initial paint | Low paint cost, fast content display | [OK] Good |