academia-de-codigo / react-semantic-toasts

React Semantic UI notifications library
MIT License
87 stars 31 forks source link

Toaster appears twice #38

Open millerox opened 5 years ago

millerox commented 5 years ago

Thanks for the toast, it's really easy to use!

When a condition met, toast appears in a particular component. SemanticToastContainer is placed inside of the component. When a user navigates to another component, and then comes back and toast condition is met again, two toasters appear.

An issue can be solved, if move SemanticToastContainer to the higher hierarchy. However, in my case, I need toast time option to be 0 (toaster do not disappear until the user clicks close icon). If I move SemanticToastContainer to the higher hierarchy, toaster stays on all the pages/components until the user closes it.

I would like the toaster to stay or until the user close it, or until the user navigate to another context . Any suggestions how it can be solved? thanks!

andrew-mclachlan commented 4 years ago

I tried this too but it still occurs despite being at the highest hierarchy.

andrew-mclachlan commented 4 years ago

I think my issue has been resolved. My issue was not with the Toast or the container, but when it was invoked/called. I had the toast inside an event emitter that wasn't within my React's useEffect.