From ca1ff2c7788ddc506d6fda726fe00c1de9914b0b Mon Sep 17 00:00:00 2001 From: Artus Date: Tue, 12 Nov 2019 16:07:15 +0100 Subject: [PATCH] small fixes --- src/Page/Chest.elm | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/Page/Chest.elm b/src/Page/Chest.elm index aec9b75..358b712 100644 --- a/src/Page/Chest.elm +++ b/src/Page/Chest.elm @@ -737,18 +737,17 @@ update msg model = state = model.state - autoState = - model.state.autoComplete + -- Recalculate auto-completion results + matches = + if itemName == "" then + [] - -- For now, merchantLoot *IS* the inventory - results = - model.state.merchantLoot - |> List.filter (\i -> insensitiveContains itemName i.name) + else + -- TODO: For now, merchantLoot *IS* the inventory + model.state.merchantLoot + |> List.filter (\i -> insensitiveContains itemName i.name) in - { model - | state = - { state | autoComplete = results } - } + { model | state = { state | autoComplete = matches } } -- Update newItem field and erase other (outdated) values |> update (SetNewItem <| Item 0 itemName 0) @@ -899,12 +898,9 @@ setError error model = } - --- DbUpdates always refer to the active player's loot - - applyUpdate : Api.Update -> Model -> Model applyUpdate u model = + {- Note: DbUpdates always refer to the active player's loot -} let state = model.state