Fix updating item list when there are no results

This commit is contained in:
Eike Kettner 2020-06-06 15:15:53 +02:00
parent 071ab60a5c
commit 77e8a51acd

View File

@ -56,7 +56,9 @@ update key flags msg model =
Nothing -> Nothing ->
Cmd.none Cmd.none
in in
( { model | itemListModel = m2 }, Cmd.batch [ Cmd.map ItemCardListMsg c2, cmd ] ) ( { model | itemListModel = m2 }
, Cmd.batch [ Cmd.map ItemCardListMsg c2, cmd ]
)
ItemSearchResp (Ok list) -> ItemSearchResp (Ok list) ->
let let
@ -72,10 +74,7 @@ update key flags msg model =
, moreAvailable = list.groups /= [] , moreAvailable = list.groups /= []
} }
in in
if list.groups == [] then if model.searchOffset == 0 then
( m, Cmd.none )
else if model.searchOffset == 0 then
update key flags (ItemCardListMsg (Comp.ItemCardList.SetResults list)) m update key flags (ItemCardListMsg (Comp.ItemCardList.SetResults list)) m
else else
@ -112,9 +111,13 @@ doSearch : Flags -> Model -> ( Model, Cmd Msg )
doSearch flags model = doSearch flags model =
let let
cmd = cmd =
doSearchCmd flags model.searchOffset model.searchMenuModel doSearchCmd flags 0 model.searchMenuModel
in in
( { model | searchInProgress = True, viewMode = Listing } ( { model
| searchInProgress = True
, viewMode = Listing
, searchOffset = 0
}
, cmd , cmd
) )