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