Wrong "latest dashboard" version is selected when using browser-option "restore last session"

Description

We recently discovered a confusing problem with Grafana dashboards.
After a user saves some changes in a dashboard and afterwards restarts the browser, the dashboard is shown in a version before the last save. This is highly confusing, especially because it happens to the user who just saved a new dashboard version…
Fortunately, this is not a permanent problem, as it can be solved simply by reloading the tab. Still: you have to know about this or you’ll find yourself constantly restoring the dashboard to the “real” latest version unnecessarily… In fact, this is what’s happened in my company several times now: users restore the “real latest version” and thus create a new version… Only because they think someone reset the dashboard to an earlier version or something…

Reproducable steps

  1. (setup browser to “restore last session” when starting)
  2. create a new dashboard and save it
  3. change something and save again, effectively creating a second version
  4. close browser and start it again
  5. the initial dashboard version will be shown
  6. check the dashboard versions and recognize the wrong “latest” version

The following screenshot has been made at step 5:

Further Information

This happens only if the browser is configured to reopen “last sessions”, so the Grafana tab will be opened instantly when the browser (re-)starts. Also, a simple reload of the tab solves the problem.
Nevertheless, IMHO this should be investigated because it’s a confusing behaviour.

Environment

  • Grafana Version 5.2.2
  • MySQL Backend
  • Firefox Browser Version 60.0.2

Expected behaviour

Regardless of the browser settings, a user should always be looking at the correct latest dashboard version. Looks like something could be done about that, because the “versions” view clearly shows every available versions correctly, only does not pick the right one.