MagicMirrorOrg / MagicMirror

MagicMirror² is an open source modular smart mirror platform. With a growing list of installable modules, the MagicMirror² allows you to convert your hallway or bathroom mirror into your personal assistant.
http://magicmirror.builders
MIT License
19.79k stars 4.21k forks source link

updatenotification module fails to load if any other module throws an error in creating their dom #3117

Closed Ryanclbryant closed 3 weeks ago

Ryanclbryant commented 1 year ago

I've had a broken third party module for several months and didn't realize it; the update was available but because the issue was with creating the dom on initial load we had issues with receiving the required notifications.

I noticed that MODULE_DOM_CREATED is being sent, but never DOM_OBJECTS_CREATED, which updatenotification.js relies on here.

Would it be a feasible replacement for updatenotification to look for the MODULE_DOM_CREATED notification instead?

Sample of a successful load:

[Info] notificationReceived(): MODULE_DOM_CREATED (MMM-CalendarExt3.js, line 142)
[Info] notificationReceived(): DOM_OBJECTS_CREATED (MMM-CalendarExt3.js, line 142)

Sample of where one of any modules experiences an error during initial dom creation:

[Info] All modules started! (main.js, line 501)
[Info] notificationReceived(): ALL_MODULES_STARTED (MMM-CalendarExt3.js, line 142)
[Warning] [CX3] Module is not prepared yet, wait a while. (MMM-CalendarExt3.js, line 229)
[Error] TypeError: undefined is not an object (evaluating 'this.tasks.items') — MMM-Todoist.js:579
    error
[Info] notificationReceived(): MODULE_DOM_CREATED (MMM-CalendarExt3.js, line 142)
[Error] Unhandled Promise Rejection: TypeError: undefined is not an object (evaluating 'this.tasks.items')
    (anonymous function) (MMM-Todoist.js:579)
[Info] notificationReceived(): NEWS_FEED_UPDATE (MMM-CalendarExt3.js, line 142)

Making this change would support the module to raise the flag that updates are available, which actually resolved the error that MMM-Todoist was hitting.

sdetweil commented 1 year ago

there are all kinds of places where there is no error checking

khassel commented 1 year ago

@rejas @sdetweil any objections to replace DOM_OBJECTS_CREATED with MODULE_DOM_CREATED?

rejas commented 1 year ago

DOM_OBJECTS_CREATED is send after all modules are done, MODULE_DOM_CREATED is send for each module, so how would you implement the logic in the updatenotification module then?

bugsounet commented 1 year ago

@rejas but in this case if we use MODULE_DOM_CREATED, i'm not sure that Module.definitions is set correctly we have to check around this

github-actions[bot] commented 1 month ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.