Q:

Elm: How to fetch data on page load with Navigation.newUrl?

I have an Elm application with multiple pages/routes. I have a "/dashboard" route that needs data on page load. 
I had to modify the init function for when the user does a hard browser reload, and I had to modify the update function's onLocationChange clause for when Navigation.newUrl is called.
My question is: is this the right way to do this? I hate having to modify two functions when it feels like there should be one place that handles this.

A:

I think you could let update function handle all the Cmd creation.
init : Navigation.Location -> ( Model, Cmd Msg )
init location =
    update
        (LocationChange location)
        initialModel

