evancz/elm-architecture-tutorial

Checkboxes initial state ignored in labeled checkbox example

youroff opened this issue · 1 comments

Not sure if that was omitted cause it was out of scope of the example, but stating that By using functions instead, we are able to have reuse in our view without disrupting our Model or update is a bit unfair in this case. Without at least initial state synchronization these checkboxes are useless, even in provided example it seems to work wrong, as in initial model all of the checkboxes are set true but rendered unchecked.

https://guide.elm-lang.org/reuse/checkboxes.html

I think the checkbox examples did not make it into the latest version of the guide, and this repo is meant to match the guide.

You can use the checked attribute to set the checkbox state, and if I recall correctly, the examples you mention did not use it in an effort to keep the code simpler. The options were either that (1) it stayed a bit confusing or (2) the code became a little bit too complex for where I wanted it to be in the guide. Both seemed not so good, so the solution was to find a better way to present the material.