RMD018 — State written during a @compute
A @compute derives a value and returns it. Writing reactive state while it
derives is worse than the same write in render() (RMD001):
if the compute reads the signal it wrote, it invalidates its own cache and recomputes forever; if
it reads another, every read of the compute now fires that signal's listeners too, re-rendering
whatever only wanted a derived value.
To produce a value, return it. To cause an effect, use an event handler or
a subscription. To count runs or otherwise instrument the compute, use a plain
(non-@state) field — render re-runs on the same changes and reads its latest value.
Next
- All diagnostics — every code the framework can report.
- Checking your app — the faults proved from the source, before anything runs.