Ramonda

fresh-object-in-props

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 component is handed an object or array built during the render, so it is a new value every time and comparison can never match — lift it to a field or a @compute, or declare it on the child with @StableProps.

A literal written in JSX is built during the render, so the child is handed a different object every time — never equal to the one before it, however identical its contents. Comparison cannot match, and the child renders again whenever its parent does, whether or not anything about it changed. Measured: one child goes from one render to two; a list of a thousand rows is a thousand children that cannot be skipped.

Moving the literal does not fix it. A const at the top of render(), an arm of a ternary, a fallback behind ??, and a helper that returns a literal — however many helpers deep — are all the same object built at the same moment, and all of them are reported.

Inside a map or a list this is the same fault at the worst scale — one literal in the callback is one child per row that can never be skipped — and lifting it out is not open to you, because the value depends on the row. Two things do work: declare the prop on the ROW component with @StableProps, or build the values once in a @compute that maps the array and hand each row the one that belongs to it.

Where the value never changes, lift it out of the render — a module constant, or a field on the class. Where it is derived from state or props, a @compute gives you the same value back until something it reads changes, which is exactly what comparison needs.

Where the literal is the API you want, the CHILD can declare the prop a value with @StableProps("conf"). The framework then compares it by content and hands the child back the identity it already had, and this stops reporting the call site.

The page is correct either way, which is why this is a warning: what it costs is work, not output. <div style={{…}}> is NOT reported — a host element hands nothing to a component, so there is nothing to compare.

Next