don't update the history state until we know the request has been successful to prevent a Back button bug