Skip to content

Commit

Permalink
Inline
Browse files Browse the repository at this point in the history
Extracted function save a few lines but did not help with clarity.
  • Loading branch information
mostlyobvious committed Jan 27, 2024
1 parent a8d4774 commit ce22672
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions ruby_event_store-browser/elm/src/Main.elm
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,22 @@ update msg model =
)

( GotShowStreamMsg showStreamUIMsg, ShowStream showStreamModel ) ->
Page.ShowStream.update showStreamUIMsg showStreamModel
|> updateWith ShowStream GotShowStreamMsg model
let
( subModel, subCmd ) =
Page.ShowStream.update showStreamUIMsg showStreamModel
in
( { model | page = ShowStream subModel }
, Cmd.map GotShowStreamMsg subCmd
)

( GotShowEventMsg openedEventUIMsg, ShowEvent showEventModel ) ->
Page.ShowEvent.update openedEventUIMsg showEventModel
|> updateWith ShowEvent GotShowEventMsg model
let
( subModel, subCmd ) =
Page.ShowEvent.update openedEventUIMsg showEventModel
in
( { model | page = ShowEvent subModel }
, Cmd.map GotShowEventMsg subCmd
)

( GotLayoutMsg layoutMsg, _ ) ->
case model.flags of
Expand All @@ -112,13 +122,6 @@ update msg model =
( model, Cmd.none )


updateWith : (subModel -> Page) -> (subMsg -> Msg) -> Model -> ( subModel, Cmd subMsg ) -> ( Model, Cmd Msg )
updateWith toPageModel toMsg model ( subModel, subCmd ) =
( { model | page = toPageModel subModel }
, Cmd.map toMsg subCmd
)


urlUpdate : Model -> Url.Url -> ( Model, Cmd Msg )
urlUpdate model location =
case model.flags of
Expand Down

0 comments on commit ce22672

Please sign in to comment.