Ramonda

unserializable-state

This fails the run. Where it is wrong about your code, // ramonda-check-ignore <reason> on the line says so, and the reason is printed on every run.

Reported when a @state field holds a Map, a Set, a Date, a function or a class instance, and the project renders on a server.

The framework reports the same fault while running, as RMD019 and RMD033 — but only once the line actually runs. This is the same fault proved from the source instead.

The server's state travels to the client as JSON, and none of these survives the trip. It fails quietly, too: nothing throws on the way out, so a Map becomes {} and a Date becomes a string, and the page fails later, somewhere else, on a method the value no longer has.

Keep a form of it that survives — an id, an ISO string, an array of entries — and rebuild the object where it is used, or in a @compute beside it. Where the value is only ever wanted in the browser, build it in @created, which hydration skips, and leave it out of state.

This is only asked of a project that renders on a server. With no blob to cross, a Map in state is correct and nothing here has an opinion about it.

Next