react-redux-toastr icon indicating copy to clipboard operation
react-redux-toastr copied to clipboard

No support for multiple toastr instances

Open gowikel opened this issue 3 years ago • 1 comments
trafficstars

Hi on our application we are using two instances of a toastr component. One of them is global and is instantiated straight away in the root component. But our users can see a portion of the application in fullscreen and we instantiate another toastr component when we move to fullscreen. We realised that when the second one unmounts, the global one stops working. Inspecting the code we saw that the unmounting toastr removes all listeners breaking the communication of the global one.

gowikel avatar Apr 27 '22 14:04 gowikel

Hi @gowikel, the easiest way to solve this will be to add another prop like removeEventEmitterOnUnmount here which is default to true and in componentWillUnmount we could check for it and preventing from removing the listeners based on that.

diegoddox avatar Apr 28 '22 08:04 diegoddox