Outdated session on JS page navigation

Having a devil of a time diagnosing a weird issue that I am only seeing in prod, not dev. I have am storing an id for a record in the session and have a button that allows the user to update the ID via JS location.assign like so:

      .then(response => {

The controller action is pretty straightforward:

  def current(conn, %{"team_id" => id}) do
    team = Ecto.assoc(conn.assigns[:current_user], :teams)
    |> where(id: ^id)
    |> Repo.one!

    |> put_session(:team_id, team.id)
    |> configure_session(renew: true)
    |> put_status(200)
    |> json("")

In both dev and prod, this endpoint logs 200 in the response and navigates to “/” as expected, reloading almost everything on the page. But in one spot I am displaying the record data and it does not update in prod: <%= @current_team.name %>. It updates fine in dev. It also shows the correct value if I manually refresh the page after the redirect.

My understanding is that the session value should be updated by the time location.assign is called, and that location.assign should force the page to reload. Anybody have an idea of something I am missing?

This was a JS issue. Apparently location.assign uses the browser cache. In my case using location.reload(true) works fine but it would be nice to know how to force the browser to ignore the cache as if the page was requested through the url. The only suggestions I could find were to append a random string to the query params. :roll_eyes: