use debounce to prevent click event firing twice with back button