Skip to content
InsightLogEditorial Notes
菜单

这篇文章尚未翻译成中文,当前显示英语原文。

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.

Daniel Okafor更新于 2026年11月20日阅读 1 分钟阅读 404
分享到 X
好评 94%

核心摘要 · 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:

  1. the framework runtime
  2. client component code
  3. the serialized RSC payload
  4. 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

MetricWhereWhy
Route JS transferbrowser network panel or build reportShows the real shipped code
RSC payload sizeHTML/stream sizeCatches oversized props
Long tasks during loadperformance traceShows hydration and script cost

Track them per route template, not per page, so the numbers stay comparable.

Common mistakes

  1. Importing a markdown renderer into a client component.
  2. Passing server data through a client wrapper that does nothing.
  3. Loading analytics before the article is readable.
  4. 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.

这篇文章对你有帮助吗?

你的评价会告诉其他读者这篇文章的可信度。

好评 94%

Daniel Okafor
Daniel Okafor

Senior data editor · InsightLog

Builds data pipelines and measurement systems, and writes about the context behind every number.

Markdown 原文: /zh/posts/server-components-hydration-cost/raw

引用来源: https://insightlog.site/zh/posts/server-components-hydration-cost

Continue reading

延伸阅读