rtfeldman / elm-css

Typed CSS in Elm.
https://package.elm-lang.org/packages/rtfeldman/elm-css/latest
BSD 3-Clause "New" or "Revised" License
1.23k stars 196 forks source link

Dynamically rendered input doesn't update value #524

Closed dccarmo closed 4 years ago

dccarmo commented 4 years ago

Here's the Ellie using elm-css: https://ellie-app.com/9MyFHhW2Y5ca1

If you tap "Show", it'll display the input but it will never update its value.

If I use the 'regular' HTML package: https://ellie-app.com/9MyG3z2w242a1 it works as expected.

Am I missing something?

dccarmo commented 4 years ago

From here: https://elmlang.slack.com/archives/C0CJ3SBBM/p1598279016126700?thread_ts=1598278384.123600&cid=C0CJ3SBBM

Joshua 23 hours ago I'm pretty sure your elm-css example is correct, and you can observe a side-effect of the vdom diffing algorithm using just elm/hml: You create some Html Msg representing the input with an empty value as soon as you click the button. Typing something sends messages correctly, but the model.input field never gets updated to new Html Msg containing an input with the value set to whatever you got. It works using elm/html because the virtual dom thinks it can skip some work here for some reason.