Performance: Revalidation patterns
MEDIUM IMPACT
This affects how quickly updated content appears on the page and how often the server regenerates pages, impacting load speed and server response.
export async function getStaticProps() { const data = await fetch('https://api.example.com/data'); return { props: { data }, revalidate: 60 // revalidates every 60 seconds }; }
export async function getStaticProps() { const data = await fetch('https://api.example.com/data'); return { props: { data }, revalidate: 1 // revalidates every 1 second }; }
| Pattern | Server Regenerations | Network Delay | LCP Impact | Verdict |
|---|---|---|---|---|
| Revalidate every 1 second | High (every request) | High | High delay | [X] Bad |
| Revalidate every 60 seconds | Low (once per minute) | Low | Low delay | [OK] Good |
| No revalidation | None | Low | Stale content hurts UX | [! ] OK |
| On-demand revalidation | Only on content change | Low | Fast fresh content | [OK] Good |