Merge pull request #51 from Nakrar/master

fix multiply view calls on single msg
This commit is contained in:
Ryan Haskell-Glatz 2020-08-02 14:11:04 -05:00 committed by GitHub
commit 51a3b375b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -66,23 +66,23 @@ import Spa.Url as Url
view : Model -> Document Msg
view =
bundle >> .view
view model =
(bundle model).view ()
subscriptions : Model -> Sub Msg
subscriptions =
bundle >> .subscriptions
subscriptions model =
(bundle model).subscriptions ()
save : Model -> Shared.Model -> Shared.Model
save =
bundle >> .save
save model =
(bundle model).save ()
load : Model -> Shared.Model -> ( Model, Cmd Msg )
load =
bundle >> .load
load model =
(bundle model).load ()
@ -97,10 +97,10 @@ type alias Upgraded params model msg =
type alias Bundle =
{ view : Document Msg
, subscriptions : Sub Msg
, save : Shared.Model -> Shared.Model
, load : Shared.Model -> ( Model, Cmd Msg )
{ view : () -> Document Msg
, subscriptions : () -> Sub Msg
, save : () -> Shared.Model -> Shared.Model
, load : () -> Shared.Model -> ( Model, Cmd Msg )
}
@ -114,10 +114,10 @@ upgrade toModel toMsg page =
page.update msg model |> Tuple.mapBoth toModel (Cmd.map toMsg)
bundle_ model =
{ view = page.view model |> Document.map toMsg
, subscriptions = page.subscriptions model |> Sub.map toMsg
, save = page.save model
, load = load_ model
{ view = \\_ -> page.view model |> Document.map toMsg
, subscriptions = \\_ -> page.subscriptions model |> Sub.map toMsg
, save = \\_ -> page.save model
, load = \\_ -> load_ model
}
load_ model shared =