Skip to content

Feature request: partial hydration #144

Open
@kaicataldo

Description

@kaicataldo

Some context

I've been searching for a JSX-based, islands architecture static site generator for a while now (see my first attempt to solve this problem many years ago in 11ty). I had resigned myself to having to write what would effectively be a thin wrapper around vite that implemented this, but just hadn't found the time yet.

Feature request/discussion

I just came across the prerender option provided by this plugin and this gets me just about everything I want in a static site generator except for the partial hydration part. Is that something the team would be amenable to supporting in this plugin, or is that too opinionated?

There are a few existing projects that implement this ability to notate in different ways:

  • My Eleventy plugin uses a higher order component to mark island root components at build time.
  • Fresh will hydrate components in the islands/ directory.
  • Astro uses a directive to achieve this.

Though I went a different route when I tried to solve this in my plugin a few years ago, I would personally advocate for an API similar to Astro's now. Fresh's API doesn't allow the user to denote different kinds of hydration strategies for a given island and the higher order component isn't as idiomatic as it once was. Either adding a directive to the root component or creating something like an InteractiveRoot wrapper component would allow the user to arbitrarily pick island root components as well as denote different hydration strategies for different instances of the same component, when appropriate.

If this is something the team is open to, I'd be more than happy to take a crack at implementing it. If it isn't and someone has a better idea of how one might go about this (maybe a separate plugin?), I'd love to hear it!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions