Rendering Strategies (App Router)
Priority: P0 (CRITICAL)
Choose rendering strategy based on data freshness and scaling needs. See Strategy Matrix.
Guidelines
- SSG (Default): Build-time render. Use
generateStaticParams. - SSR: Per-request render. Triggered by
cookies(),headers(), orcache: 'no-store'. - Streaming: Wrap slow components in
<Suspense>to avoid blocking. - ISR: Post-build updates. Use
revalidate(time) orrevalidatePath(on-demand). - PPR: Static shell + dynamic holes. Experimental
pprconfig. - Runtime: Node.js (Full) or Edge (Lighter/Faster).
Scaling & Hydration
- Static Shell: Render layout as static, personalize via Suspense.
- Error Boundaries: Use
error.tsxwithreset()to catch runtime errors. - Hydration Safety: Avoid
typeof windoworDate.now()in initial render. UseuseEffect.
Anti-Patterns
- No Root Awaits: Avoid waterfalls in
page.tsx. Use Streaming. - Bailouts: Understand Suspense Bailout Rules.
References
- Strategy Selection Matrix
- Implementation Details
- Scaling Patterns