A computed() writes to state
The message
MARKLESS_STATE_WRITE_IN_COMPUTED: `<source>` writes to `<target>` while deriving a computed value. A computed is a graph read, so writing graph state there would re-trigger the same derivation.
A computed is a demand-driven read in the graph; the only effects in the system are compiler-generated DOM updates, so a write inside a derive is a self-waking cycle that cannot resume.
Keep computed() pure. Move graph writes to an event handler and derive only from graph reads.
https://markless.dev/errors/MARKLESS_STATE_WRITE_IN_COMPUTEDWords in angle brackets change from case to case.
Why
A computed() reads values and returns a result. This one also writes to state, and that write wakes the same computed again.
Fix
Keep computed() free of writes. Move the write into an event handler.
Related
Where Markless raises it
Button sounds are from Josh Comeau's Button Sounds library.