skip to content

When designing an online store's frontend, which page types would you ship as server HTML with a few hydrated islands, and which need the whole page hydrated or client-rendered?

level: seniorimportance: should knowfreq 41%

answer

  1. a page can look ready and not respond
  2. hydration pays for static parts too
  3. interactivity local or shared across the page
  4. product page: gallery and buy box only
  5. islands talk through events, URL or server

basics

~20 s

Mostly static pages with local interactivity, such as product detail and help articles, become server HTML with islands, cutting their script. Checkout and the seller dashboard, one interactive surface with shared state, keep full hydration or client rendering.

solid answer

~50 s

Hydration means the browser downloads and runs the components' code, plus the data they were rendered with, so server HTML becomes interactive; with whole-page hydration that cost covers static parts too, and the page looks ready before it responds. So I ask, per page type, how much is interactive and whether that interactivity is local or shared. A product page is mostly description and specs; only the gallery, the variant picker with add-to-cart and the reviews widget need script, so they become islands and the rest ships as plain HTML. The category page's filters drive the result grid, so they belong in one island or a plain form that changes the URL. Checkout and the seller dashboard share state across every part, so they get full hydration or client rendering. The cost of islands is wiring between them, such as add-to-cart updating the header's cart count.

code

html · 24 lines
html
<header>
  <a href="/">Store</a>
  <span data-island="cart-count" data-wake="idle"></span>
</header>
<main>
  <h1>Steel kettle, 1.7 L</h1>
  <div data-island="gallery" data-wake="load">
    <img src="/img/kettle-1.jpg" alt="Steel kettle, front view">
  </div>
  <section class="specs">
    <p>Capacity 1.7 L. Power 2200 W.</p>
  </section>
  <form data-island="buy-box" data-wake="load" method="post" action="/cart">
    <select name="variant">
      <option>Steel</option>
      <option>Black</option>
    </select>
    <button type="submit">Add to cart</button>
  </form>
  <section data-island="reviews" data-wake="visible">
    <p>4.6 of 5 from 212 reviews</p>
  </section>
</main>
<script type="module" src="/islands/boot.js"></script>

go deeper

for a junior

Recall that hydration makes server-sent HTML interactive by running scripts, and that an island is one interactive region on an otherwise static page.

for a middle

Explain what whole-page hydration downloads and runs, and how islands limit that to the regions that need it.

for a senior

Sort a store's page types by whether their interactivity is local or shared, choose islands or full hydration per type, and name the wiring and navigation costs islands bring.

for a principal

Decide where the organisation draws the islands line by default and when a page type's growth in shared interactivity justifies moving it to a single hydrated tree.

## What hydration costs a page **Hydration** is the step that makes server-rendered HTML interactive: the browser runs client-side scripts that attach event handlers and application state to the markup the server already sent. Whole-page hydration has three costs: - **Script weight** - the code for every component on the page is downloaded and parsed, including components that will never respond to input. - **Duplicated data** - the data the server rendered with is usually serialised into the document so the client can render the same thing again. - **A gap between looking ready and being ready** - rendering guidance warns that a server-rendered page can appear loaded yet not respond to input until its scripts run and attach handlers, which hurts responsiveness (INP) on slower phones. For a page that is mostly text and images, most of that work buys nothing. ## Islands and partial hydration The **islands** pattern renders the page as server HTML and marks a few regions as interactive. Each island ships its own script and hydrates on its own schedule - on load, when the browser is idle, or when it scrolls into view - while everything else stays plain HTML with no script. Islands are independent roots: there is no top-down pass over one page-wide tree, and one island's failure does not stop another. **Progressive hydration** keeps one page-wide tree but hydrates its parts over time; **partial hydration** goes further and skips the parts with no interactivity. Islands reach the same goal by never building the page-wide tree in the browser at all. ## Page type by page type | Page type | Interactive parts | Scope of interactivity | Choice | |---|---|---|---| | Help-centre article | feedback widget | local | server HTML with one island, or none | | Product detail | gallery, variant picker and add-to-cart, reviews | local | server HTML with three islands | | Home | carousel, recommendations | local | server HTML with islands | | Category listing | filters and result grid | shared between the two | one island over both, or a plain filter form that changes the URL | | Cart | quantities, totals, promotions | shared | full hydration or client rendering | | Checkout | address, shipping, payment, totals | shared across every step | full hydration or client rendering | | Seller analytics dashboard | filters, charts, tables | shared, app-like | client rendering | The test is not "how much script" but **whether the interactive parts are locally scoped**. Islands fit documentation, articles and product pages where only a gallery and a buy box need script; they fit badly where shared state flows between many widgets or a change updates half the page. ## Where islands hurt - **Cross-island communication.** Add-to-cart lives in one island and the header's cart count in another; they share no in-memory state, so they talk through a DOM event, the URL, a small shared module or the server. - **Navigation.** Moving between island pages is usually a full document load. Rendering guidance notes that with partial hydration, client-side navigation cannot assume the server HTML for inert parts is available without a full page load. - **Boundary decisions become design work.** Someone must decide, component by component, what is interactive and when it wakes. - **Component kits assume one tree.** Many widely used component kits are written for a single application tree, so a widget built for one may need wrapping before it can live as an island. - **Drift toward an app.** If a product page grows a configurator whose every choice reprices the whole page, the interactivity has become page-wide and islands start to fight it. ## Deciding in the round 1. List each page type's interactive parts. 2. Mark each part local or shared with other parts of the page. 3. Mostly static with local parts: server HTML with islands, each hydrating as late as its use allows. 4. Shared across the page: full hydration, or client rendering when the page is also personal and unindexed. 5. Name the wiring the islands need and who owns it. The payoff is concrete: help and product pages ship a fraction of the script, respond sooner on mid-range phones, and keep their content in the first response for crawlers.

  • Add-to-cart is one island and the header's cart count is another. How do they stay in step?
    They share no in-memory state, so give them a narrow channel: the buy box dispatches a DOM event such as 'cart changed' with the new count after the server confirms, and the header island listens. The server stays the source of truth, so the header can also re-read the count on load. If many islands start needing that channel, the page is drifting out of islands territory.
  • When would you abandon islands for the product page?
    When its interactivity becomes page-wide: a configurator where every option reprices the page, swaps the gallery and changes delivery dates, with state flowing between most regions. Then the wiring between islands costs more than one hydrated tree, so I would hydrate the whole page and spend the effort on shipping less script to it.

  • Server rendering alone removes the script a page ships
  • Islands suit checkout because they always ship less script
  • Two islands share component state just like one tree does
  • A page that looks fully rendered is ready for input
  • Hydrate every component on load so nothing feels unresponsive