Store loop state in localStorage