RMD033 — State that cannot cross to the client
@state formatter = new Intl.NumberFormat("sr-RS"); // reported
Only JSON-serializable state travels in the hydration blob, and it fails in three different ways. A
function is dropped, so the client starts with whatever the field initialises to. A value
JSON.stringify throws on — a bigint, a circular object — never reaches the blob at all, and the
whole component starts from its initialisers. And a Date, a Map, a Set or a class instance
survives: it arrives as a string or as a plain object, so the field is not missing, it is the wrong
type, and the first method call on it throws. Either way the two sides disagree from the first render.
Keep the value out of state and derive it on the client: in @created, which is
skipped during hydration, or in a @compute. Where the server's own answer is
needed, store a serializable form of it — an id, an ISO string — and rebuild the object where it is
used.
Next
- All diagnostics — every code the framework can report.
- Checking your app — the faults proved from the source, before anything runs.