diff --git a/ruby_event_store-browser/elm/src/Layout.elm b/ruby_event_store-browser/elm/src/Layout.elm index d81705e44e..b81abbc0be 100644 --- a/ruby_event_store-browser/elm/src/Layout.elm +++ b/ruby_event_store-browser/elm/src/Layout.elm @@ -61,8 +61,17 @@ update msg model = case msg of SearchMsg searchMsg -> let - ( newSearch, cmd ) = - Search.update searchMsg model.internal.search (goToStream model) + internal = + model.internal + + search = + internal.search + + ( newSearchWrapped, cmd ) = + Search.update searchMsg (WrappedModel search model.key model.time model.flags) (goToStream model) + + newSearch = + newSearchWrapped.internal in ( { model | internal = Model newSearch }, Cmd.map SearchMsg cmd ) diff --git a/ruby_event_store-browser/elm/src/Search.elm b/ruby_event_store-browser/elm/src/Search.elm index 8297ee2718..52eb2c2b7f 100644 --- a/ruby_event_store-browser/elm/src/Search.elm +++ b/ruby_event_store-browser/elm/src/Search.elm @@ -3,6 +3,7 @@ module Search exposing (..) import Html exposing (..) import Html.Attributes exposing (class, id, list, placeholder, value) import Html.Events exposing (onInput, onSubmit) +import WrappedModel exposing (WrappedModel) type alias Stream = @@ -27,11 +28,21 @@ init = } -update : Msg -> Model -> (String -> Cmd Msg) -> ( Model, Cmd Msg ) +update : Msg -> WrappedModel Model -> (String -> Cmd Msg) -> ( WrappedModel Model, Cmd Msg ) update msg model onSubmit = case msg of StreamChanged stream -> - ( { model | value = stream }, Cmd.none ) + let + internal = + model.internal + + updatedInternal = + { internal | value = stream } + + wrappedModel = + { model | internal = updatedInternal } + in + ( wrappedModel, Cmd.none ) GoToStream stream -> ( model, onSubmit stream )