-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Uncaught TypeError: Cannot read property dismiss of null (alert.js) #1240
Comments
I tried to fix with some variations of this: //Dismiss alert and remove from this.alerts
// if (this.alerts[sender.name] != null) {
this.alerts[sender.name].dismiss();
this.alerts[sender.name] = ""; // was null
// } But it didn't work...and seem to need something else. |
It's because a alert is dismissed which doesn't exist. Which module is firing the alerts? Might be worth checking that code as well. |
It's our module MMM-Assistant, that seem to use Alerts to show pop-up screen results for Snowboy requests... But, why didn't my if() statement work then? (Actually it seem to have worked, but then got another error message instead.) |
|
@fewieden Yeah, but I already tried that before the comments shown above, and it just propagated the error elsewhere... Seem to be some kind of race condition...
Or maybe I need to enclose the whole thing before the closing bracket? |
what is the other error? I think you need to put the dom actions into your if statement
if there is no alert to dismiss, there should also be no dom action. |
Might be a good idea to check with @paviro, he made the alert module. |
Oh man :D that was ages ago. I will have a look later today :) |
Make sure there is something to remove, before we attempt to remove the notifications. - This fixes MagicMirrorOrg#1240
@paviro It will hunt you for the rest of you life. ;) |
I really hoped someone would replace this 💩 code really fast 😅 |
@E3V3A If that fix seems to work for you, feel free to send a PR. I'll merge it after all test's are finished. |
I keep getting random events where the error is:
Uncaught TypeError: Cannot read property 'dismiss' of null
The error is coming from the Alert default module on Line 113, in alert.js:
@MichMich
Does this have to be
null
or can it also be set to""
or something else?Any ideas how to fix or work around this?
I'm surprised nobody else has reported this issue, so I want to eliminate that it is a problem with my module.
The text was updated successfully, but these errors were encountered: