docs(rfcs): propose an opt-in islands interface for renderers
Merged
KI
11d ago+457+457+012345678901234567890123456789-0-0-0123456789
Problem
Component islands work only with React. The pieces behind them are either written against React or sit behind an isReactRenderer check:
- the server wrapper
createFarmIsolatedClientBoundary; - the export transform;
- the browser runtime's error boundary.
So a custom renderer can't use them. Its pages hydrate as one whole route, and async pages stay server-only.
Change
This adds RFC 0012, "An islands interface for renderers". It's a draft and there's no code change. It only adds to core; React, Preact, Solid, Vue and Svelte are unchanged.
- The rule: core exposes, renderers opt in.
- A renderer declares the capability in its descriptor (
capabilities.islands) and exports the hook (withIsland). - Without the capability, core takes today's path. Acceptance requires byte-identical output for the official renderer examples.
- If a renderer declares the capability but the export is missing, startup fails and names the export.
- A renderer declares the capability in its descriptor (
- Built on islx, not a second copy in core. islx#91 (released in 0.0.28) has the wire format, the props codec, the restore on failure and a browser runtime without React, tested in Chrome on Preact, Vue, Svelte and Solid.
- Server:
resolveFarmIsland(props, reference)stripsclient:*, picks the strategy, names the island, and returns islx's parts: the value scripts, the<f-island>element and the props script. A renderer never hardcodes the wire format. farming-labs/islx#92 addsresolveIslandMarkupfor this. - Browser: the generated entries start islx's
createIslandRuntime, withhydratebuilt from the renderer's existingcreateElementandhydrateRoot, and Farm's ownloadFarmIsolatedBoundaryandscheduleFarmIslandHydration. The renderer writes no browser code for islands. - Props: islx's codec, so
Date,Map,Setand server actions as well as JSON. - Navigation:
islands.dispose(), thenislands.hydrate()on the new page.
- Server:
- The renderer's part.
withIsland(component, reference)is an optional server export. It writes the parts around the component in its own tree. Core also provides aFarmIslandAttributestype for the renderer's JSX types. - How an app marks islands:
"use client"marks the module.- A
client:load|idle|visible|interactionattribute where the component is used sets that one island's strategy. - The RFC compares four places to put the marker and explains this choice.
- Rollout: step 0 is islx#92, an islx release with it, and a pin bump (core pins
@farm.js/islx0.0.25). Then the interface, thenexamples/custom-rendereras the reference implementation. - Separate follow-ups, each needing its own go-ahead:
- an official renderer adopting the interface (Solid is the cheapest check before calling the contract stable);
client:*for React;isolatedClientHydration: "enabled"on non-React renderers, which needs a repro first;- other rendering-layer hooks exposed the same way.
Verification
- Compiler behavior: I compiled
<Counter client:visible start={1} />on 2026-11-23 (Node 24.21.0):- oxc (Rolldown 1.3.3,
reactandpreactimport sources), babel-preset-solid 1.9.12 (dom and ssr), @vue/compiler-sfc 3.5.44 (client and SSR) and Svelte 5.56.8 (client and server) all pass it through as a prop. Vue's value is"". - Babel's
plugin-transform-react-jsx7.29.7 throws by default and works withthrowIfNamespace: false.
- oxc (Rolldown 1.3.3,
- TypeScript 5.9.3 with
@types/react19.2.13:- TS2322 without the type augmentation.
- Accepted with the augmentation, and a typo gets "Did you mean".
- The islx entries the RFC relies on: islx#92's branch passes 262 unit tests, and its Chrome e2e passes 73 with 3 skipped (existing dev-only and production-only tests), including 26 renderer tests on Preact, Vue, Svelte and Solid against the production build and the dev server.
- Code references (
loadFarmIsolatedBoundary,scheduleFarmIslandHydration,wrapWithIntegrationProviders,FarmRendererClientRoot.unmount,data-farm-solid-render-id,transformIsolatedClientBoundaryModule,assertFarmRendererServerModule,wrapClientGraph) were checked againstmainat 11af44060. oxfmt --check(0.27.0) passes on both files.
Not verified:
- Solid's island ids: a Solid
withIslandcould putdata-farm-solid-render-idon the island element, which farm-solid'shydrateRootalready reads. That's read from the code, not run. It's the first thing the Solid follow-up checks. - The non-React
isolatedClientHydrationfailure: read from the code, not run. - TypeScript checking outside React.
- Bytes inside a Farm page. islx's measured 6.0 KB gzip client is from islx#91, not a Farm build.
Documentation and release
rfcs/README.md gets a row for 0012. 0011 is taken by #3064.
The /docs/renderers/custom link is live (#3127).