concrete/islands/serializable-props
Every prop written to an island is JSON-serializable.
Every prop written to an island is JSON-serializable.
Graded by the lint stage of concrete check, in the lint venue. A violation reports this id and the file it failed at — see every rule and concrete check.
Reason
An island's props do not travel as JavaScript values. The server render writes them into
the island's marker as JSON and the browser parses them back out, because
the two halves run in different processes with nothing
shared between them. A function, a class instance or a Date has no JSON form: it either
disappears or arrives as something the island did not expect, on a published page where
nothing reports it.
Fix
Pass data, not behaviour. An island owns its own handlers, so give it what it needs to decide — a string, a number, a boolean, a plain object or array. A Date, Map, Set or RegExp crosses as its plain-JSON equivalent (an ISO string, say) that the island reconstructs on the other side.
Before and after
import { Section, section, Slot, text } from "@homepages/concrete";
// The island, imported from its own `"use client"` module.
declare const Countdown: (props: { until: Date | string; onDone?: () => void }) => React.ReactNode;
export const Open = section(
{ key: "open", label: "Open house", slots: { note: text.short({ label: "Note" }) } },
({ slot }) => (
<Section>
<Slot.Text slot={slot.note} as="p" />
<Countdown until={new Date("2026-10-01T17:00:00Z")} onDone={() => undefined} />
</Section>
),
);import { Section, section, Slot, text } from "@homepages/concrete";
declare const Countdown: (props: { until: Date | string; onDone?: () => void }) => React.ReactNode;
export const Open = section(
{ key: "open", label: "Open house", slots: { note: text.short({ label: "Note" }) } },
({ slot }) => (
<Section>
<Slot.Text slot={slot.note} as="p" />
<Countdown until="2026-10-01T17:00:00Z" />
</Section>
),
);