react-circle-slider icon indicating copy to clipboard operation
react-circle-slider copied to clipboard

Event listeners probably must be cleaned on component unmount as well.

Open vibecode opened this issue 6 years ago • 0 comments

Using create-react-app I got stumbled upon a warning saying 'Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in the componentWillUnmount method.'

This happens when you have changed some code and then the slider was being moved before live reloading actually happened. As I can see currently event listeners are being cleaned on 'mouseup' event only. Despite the situation when component was unmounted before the 'mouseup' event actually happened may seem unlikely in production, it can't be ruled out completely. So I believe all the listeners should be cleaned in the 'componentWillUnmount' as well.

vibecode avatar Jul 09 '19 10:07 vibecode