Improve cancel logic for history view refresh.