Html.Lazy
is definitely tricky. It’s really easy to put in place, but also really hard to keep make it keep work and not fail on you silently because of “spooky actions at at distance”.
IMO, this could be solved through static analysis (probably through some other means too), and I proposed an elm-review
rule idea targeting this exact problem (link below).
Detecting the problem will not solve the problem entirely as you will have to re-think and re-structure how you architecture the parts of the code that lead to that lazy view, which might be more work than what Svelte gives you out of the box, but it would remove the biggest pain point around it.