Fix: Add ALL_MODULES_STARTED fallback for missed DOM_OBJECTS_CREATED#412
Closed
DGessinger wants to merge 1 commit into
Closed
Fix: Add ALL_MODULES_STARTED fallback for missed DOM_OBJECTS_CREATED#412DGessinger wants to merge 1 commit into
DGessinger wants to merge 1 commit into
Conversation
Collaborator
|
Thanks for pointing out this problem and suggesting a solution! |
KristjanESPERANTO
added a commit
to KristjanESPERANTO/MMM-Remote-Control
that referenced
this pull request
Jul 3, 2026
Previously the remote API could get stuck as "Not initialized" if the browser's startup signal was missed, breaking every request until a manual refresh. It now fetches the current state on demand and answers the request as soon as the mirror responds. Ref Jopyth#412
Collaborator
|
I ended up fixing it a bit differently: instead of adding a second startup event, the backend now just fetches the current state on demand and answers once the mirror responds - so a missed signal isn't fatal anymore. Shipped in v5.0.4. Closing this since it's covered, but thanks for finding and pinning it down! 🙏 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
DOM_OBJECTS_CREATEDcan occasionally be missed by this module if it fires beforethe module has fully registered as a notification listener. This appears to be a
race condition that surfaced with newer Node.js/Electron versions (tested on
Node 22.22.2, MagicMirror 2.37.0, Debian 13). When missed,
sendCurrentData()isnever called,
this.initializedstaysfalseon the backend forever, and everyAPI call fails with "Not initialized, have you opened or refreshed your browser...".
Fix
Adds
ALL_MODULES_STARTEDas a fallback trigger alongsideDOM_OBJECTS_CREATED,since it's received reliably in all tested cases. A
currentDataSentflag preventssendCurrentData()from running twice if both notifications do arrive.Testing
Verified on a Raspberry Pi 4B (Debian 13, Node 22.22.2, MagicMirror 2.37.0) where
the original bug reproduced consistently, and the fix resolved it reliably across
multiple restarts.