Fix setting default in dropdown

This commit is contained in:
Eike Kettner 2020-09-01 21:59:31 +02:00
parent 237b960625
commit 8677eca6d4

View File

@ -54,7 +54,7 @@ init flags sett =
in
( { enabled = sett.enabled
, categoryModel = Comp.FixedDropdown.initString []
, category = Nothing
, category = sett.category
, scheduleModel = cem
, schedule = Data.Validated.Unknown newSchedule
, itemCountModel = Comp.IntField.init (Just 0) Nothing True "Item Count"
@ -92,7 +92,12 @@ update flags msg model =
in
( { model
| categoryModel = Comp.FixedDropdown.initString categories
, category = List.head categories
, category =
if model.category == Nothing then
List.head categories
else
model.category
}
, Cmd.none
)