Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No support for multiple toastr instances #276

Open
gowikel opened this issue Apr 27, 2022 · 1 comment
Open

No support for multiple toastr instances #276

gowikel opened this issue Apr 27, 2022 · 1 comment

Comments

@gowikel
Copy link

gowikel commented Apr 27, 2022

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.

@diegoddox
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants