-
-
Notifications
You must be signed in to change notification settings - Fork 699
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
EventManager.js:87 <SHOW_TOAST> Event is not registered. Did you forgot to bind the event ? #4
Comments
Hello, Can you provide me a sample to reproduce it please ? Thanks |
Yes! Sorry I forgot to include one originally! https://gist.github.com/jayar95/30598badd2d7b38a6b30374329752da7 |
Thanks. I'll investigate asap ! |
I think that you are calling the toast function somewhere in your render method. Right ? What is happening is that the ToastContainer is not rendered at this time which means that the event won't be bonded. In your case it will be best to call the toast function inside componentWillReceiveProps: class Foo extends Component {
componentWillReceiveProps(nextProps) {
if (nextProps.location.state && nextProps.location.state.updatedAccount)
toast('Account Updated! If you published a new account, the initial data pull could take a few minutes.', {
type: toast.TYPE.SUCCESS
});
}
render() {
return <div>Hello</div>
}
} |
As the question is still open I thought I'd share my similar struggle. I'm not trying to hijack the thread here but I thought others might search down this particular error and find my addition useful. I thought the I have a router Home page I'm trying to do a toast with as:
and the function lives in a page of toast configs imported as:
FWIW if I add a timer it does work as intended but it feels hacky. Meaning:
|
I'm now able to reproduce the issue using react router. I'm on it. |
Thanks so much - love this little bit of code btw - thanks for sharing! |
Glad you like it. Don't forget to pick the latest version 😁 |
FYI, I have a fix for that issue. I'll try to make the patch for this week or the next one. |
Awesome - thanks for the update. Will test it a bit when released. |
If there is no container, toast will be enqueue and dispatched as soon as an container is available
This has been fixed with release 1.6.0 |
Refered on this issue fkhadra/react-toastify#4 switched from componentDidMount to componentWillReceiveProps
@fkhadra When API returns 401, toast.error() works fine. But when API return 200, I'm doing a route change to /dashboard. That's when toast.success('You have been logged in successfully!') does not seem to fire up. development branch - https://github.com/realneeraj/react.git |
@RealNeeraj sure. I'll have a look later on when I'm back from work. |
Thank you! |
@RealNeeraj on login success, the ToastContainer is calling There is something that I don't understand:
I'm wondering how it's possible that componentWillUmount is called and the component is not removed from the rendering tree. |
I'm pretty new to React and I'm not really sure I understand it well though. I had just following your anwser here #117 - to put in App level. Is it because of this that even after componentWillUnmount is called, the component is still mounted (I'm just suspecting and I can we completely wrong here). |
@fkhadra - My bad brother. I had accidentally placed another Really appreciate your kind responses and help. react-toastify is a great piece of code. Thank you once again! Cheers :) |
There are times I want to show the toast outside of a button click. In these cases, the console will show the following alert:
EventManager.js:87 <SHOW_TOAST> Event is not registered. Did you forgot to bind the event ?
The text was updated successfully, but these errors were encountered: