Ramonda

RMD024 — A @compute recomputes without its answer changing

Four recomputes in a row, each producing a value equal to the last. The cache is doing nothing.

A @compute is invalidated by the signals it read, so if it recomputes on every pass while answering the same thing, something it reads is being replaced every time — most often an array or object literal rebuilt in a hook's props bag, or a value derived from one. Declare that prop with @StableProps if you own the hook, and hold the value somewhere stable if you do not — a @compute of its own, a field, a module constant.

Neither neighbour can see this one. RMD020 renders twice, and inside one strict render the compute is cached between the two calls, so both get the same value and there is nothing to compare. RMD022 compares two props bags, but skips a prop the hook declared — and a compute reading a component's prop is outside its reach entirely.

Three consecutive equal recomputes, not one: a dependency moving while the answer happens not to change is ordinary, and reporting that would put a warning on correct code.

If nothing is being rebuilt, the compute is reading something that is not reactive at all — a counter, Date.now(), a module variable. A @compute is the wrong place for that: read it once in @created and keep it in @state. (The honest limit: a compute reading only something non-reactive is never invalidated, so it is never observed either. Nothing can report a value nobody asked for again.)

Next