Fix: set correct state when using History.replaceState().

Also make view_loadout F5-safe.