schiehll / react-alert

alerts for React
MIT License
607 stars 98 forks source link

Pressing on the close button resulting in error #27

Closed xianghui closed 7 years ago

xianghui commented 7 years ago

Pressing the close button resulting in [AlertContainer.js] _onremoveAlert() calling twice (one by the user's clicking action, and another because of the setTimeOut in AlertMessage.js

During the second time,

alertRemoved would have been removed from this.state and thus undefined when it reaches this statement: alertRemoved.onClose && alertRemoved.onClose()

Probably should write it as:

alertRemoved && alertRemoved.onClose && alertRemoved.onClose()

dennybiasiolli commented 7 years ago

Thanks @xianghui for opening this issue, and thanks @davidhu2000 for the PR, this will be fixed later today 😉

dennybiasiolli commented 7 years ago

@xianghui issue fixed on master branch, @schiehll when you have some spare time can you please release a new patch version? Thanks!

schiehll commented 7 years ago

Thank you @dennybiasiolli and @davidhu2000 for your work! I've just published the new version.