この記事はまだ日本語に翻訳されていません。原文(英語)を表示しています。
The real cost of hydration in a server-first blog
Server components remove JavaScript from the bundle, but the client boundary still ships state. Measure the boundary before optimizing the framework.
要点 · TL;DR
Server components reduce client JavaScript only when the boundary is drawn carefully. The main costs are the serialized RSC payload, client component props and third-party scripts, not the framework itself.
Key facts
- A server component that passes a large object into a client component serializes that object into the payload.
- Hydration cost is paid per client component instance, not per page.
- Third-party scripts usually dominate the main-thread budget on content sites.
What actually ships
In a server-first app, the browser still downloads:
- the framework runtime
- client component code
- the serialized RSC payload
- props passed from server to client components
Only the first two are obvious in bundle reports. The payload and props are where regressions hide.
Draw the boundary around interaction
Start from what must respond on the client:
- vote buttons
- reading progress
- view tracking
- theme or language menus that need local state
Everything else — article body, table of contents, cards, related posts — can stay on the server. The boundary should follow interaction, not file structure.
The prop serialization trap
Passing a full post object into a client component serializes every field, including content. Pass the minimum: an id, a slug, a formatted count. A smaller prop surface reduces both payload size and re-render risk.
Measure three numbers
| Metric | Where | Why |
|---|---|---|
| Route JS transfer | browser network panel or build report | Shows the real shipped code |
| RSC payload size | HTML/stream size | Catches oversized props |
| Long tasks during load | performance trace | Shows hydration and script cost |
Track them per route template, not per page, so the numbers stay comparable.
Common mistakes
- Importing a markdown renderer into a client component.
- Passing server data through a client wrapper that does nothing.
- Loading analytics before the article is readable.
- Treating a fast first paint as a fast page.
Conclusion
Server components are a boundary tool, not a performance badge. Keep the client side small, measure the payload and make third-party scripts earn their place.
よくある質問
Do server components eliminate hydration?
No. They remove server-rendered components from the client bundle, but any client component still hydrates with its props.
What should I measure first?
Measure the route's JavaScript transfer size, the RSC payload size and the main-thread work during load. Then decide whether the boundary is in the right place.
この記事は役に立ちましたか?
評価は他の読者に記事の信頼性を示すシグナルになります。
Senior data editor · InsightLog
Builds data pipelines and measurement systems, and writes about the context behind every number.
マークダウン原文: /ja/posts/server-components-hydration-cost/raw
引用時の出典: https://insightlog.site/ja/posts/server-components-hydration-cost
Continue reading
あわせて読みたい
Next.js App Router でサーバーコンポーネントを使ってブログを設計する
サーバーコンポーネントを基準にデータの流れを分けると、ブログのキャッシュ戦略が単純になります。構造と落とし穴を整理します。