digidem / react-dimensions

[Looking for maintainers]

Home Page:http://lab.digital-democracy.org/react-dimensions/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

elementResize event listener fires after unmount

karleberts opened this issue · comments

Normally, when the component is unmounted, window.removeEventListener is called for the resize handler. If, however, you are using the 'elementResize' config option, the handler can end up being called after the component is unmounted.

Perhaps adding a check in the getWidth function to see if the element still exists could make this safer?

Upstream: KyleAMathews/element-resize-event#11
An alternative would be to use https://github.com/wnr/element-resize-detector but it is a large library.

Released 2.0.7 w/ @karleberts' fix.