What the title says, I’m writing an SPA with Browser.application (basically just the frontend rn, don’t judge me lol). I have buttons like this:
button [ onClick SubmitInfo ] [ text "Submit" ]
where SubmitInfo is a Msg variant (incidentally, it’s not really clear to me how the Msg type matches the interface described by onClick).
Here’s the relevant update code:
update : Msg -> Model -> ( Model, Cmd Msg )
update msg model =
SubmitInfo ->
submitInfo model
And finally:
pushUrl : Model -> String -> ( Model, Cmd Msg )
pushUrl model url =
( model, Nav.pushUrl model.key url )
submitInfo : Model -> ( Model, Cmd Msg )
submitInfo model =
pushUrl { model | loginStatus = LoggedIn } (Url.Builder.absolute [ "agreement" ] [])
Every time I push a button like this, the page loads correctly but the Model is empty again, as if the HTML has loaded from scratch again.