ELM-LANG how to make http request when clicking on browser back button
<p>I have an url like this <code>/user/3</code> where I make a http request to get the user information.</p>

<p>If I move to <code>/user/6</code> I will make another http request to get this user data.</p>

<p>My problem is when I click on the browser back button the url move back to <code>/user/3</code> but it still the <em>user 6</em> information which are display.</p>

<p>How do I do this ? Is it possible to get my old model back ? Or do I have to make again a http request to get <em>user 3</em>.</p>

<p>My <code>urlUpdate</code> looks like this:</p>

<pre><code>urlUpdate : Result String Route -&gt; Model -&gt; ( Model, Cmd Msg )
urlUpdate result model =
  let
    currentRoute =
      Routing.routeFromResult result

  in
      ( { model | route = currentRoute }, Cmd.none )
</code></pre>

<p>I'm a bit lost, I don't know where to do this.</p>

<p>If it's not clear I would like to "catch" an event when the user click on the browser back button to get the old url and then make a http request to get again this user information.</p>

<p>I use the <code>elm-navigation</code> package.</p>

<p>I have try to do this in my <code>urlUpdate</code>:</p>

<pre><code>urlUpdate : Result String Route -&gt; Model -&gt; ( Model, Cmd Msg )
urlUpdate result model =
  let
    currentRoute =
      Routing.routeFromResult result

    command =
      case currentRoute of
        Routing.HomeRoute -&gt;
          getUsers
        Routing.userRoute id -&gt;
          getUser id
        Routing.NotFoundRoute -&gt;
          Cmd.none

  in
      ( { model | route = currentRoute }, command )
</code></pre>

<p>Which is the same thing as my init function. It doesn't work because it make an infinite loop execute the <code>urlUpdate</code></p>