MagicMirrorOrg/MagicMirror · warning
module tries to update the DOM without being displayed.
Error message
module tries to update the DOM without being displayed.
What it means
updateDom is the public API a module uses to ask the frontend to re-render. If the calling module has no data.position, it is not placed in any region, so there is nothing to update; MagicMirror logs this warning and skips the update instead of crashing.
Source
Thrown at js/main.js:664
}
// Further implementation is done in the private method.
_sendNotification(notification, payload, sender);
},
/**
* Update the dom for a specific module.
* @param {Module} module The module that needs an update.
* @param {object|number} [updateOptions] The (optional) number of microseconds for the animation or object with updateOptions (speed/animates)
*/
async updateDom (module, updateOptions) {
if (!(module instanceof Module)) {
Log.error("updateDom: Sender should be a module.");
return;
}
if (!module.data.position) {
Log.warn("module tries to update the DOM without being displayed.");
return;
}
// Further implementation is done in the private method.
await _updateDom(module, updateOptions);
// Once the update is complete and rendered, send a notification to the module that the DOM has been updated
_sendNotification("MODULE_DOM_UPDATED", null, null, module);
},
/**
* Returns a collection of all modules currently active.
* @returns {Module[]} A collection of all modules currently active.
*/
getModules () {
setSelectionMethodsForModules(modules);
return modules;
},
View on GitHub (pinned to 4b4a59534f)
Solutions
- Add a valid `position` (e.g. "top_bar", "upper_third") to the module's config entry in config.js.
- Guard the updateDom call: only send updates when Module.data.position is set.
- If the module is intentionally unpositioned, use a different render mechanism (e.g. DOM manipulation via getDom only) and skip updateDom.
Example fix
// before (config.js)
{ module: "compliments", config: { ... } }
// after
{ module: "compliments", position: "lower_third", config: { ... } } Defensive patterns
Strategy: type-guard
Validate before calling
// config.js sanity check before starting:
// every module entry that calls updateDom must declare position
require('./js/check_config.js') // or: npm run config:check Type guard
function hasPosition (module) {
return module instanceof Module && typeof module.data.position === "string" && module.data.position.length > 0;
}
if (hasPosition(myModule)) myModule.sendNotification("DOM_OBJECTS_CREATED"); Prevention
- Always set a `position` for modules that render content
- Run `npm run config:check` after config edits
- Guard updateDom-triggering code with a position check
- Keep module entries in config.js complete (module, position, config)
When it happens
Trigger: Calling this.sendNotification("UPDATE_DOM"...)/updateDom from a module whose config omits `position`, or from a module dynamically created without a position, or before the module has been assigned to a region.
Common situations: Adding a new module to config.js and forgetting the `position` key while the module's code calls updateDom in notificationReceived("DOM_OBJECTS_CREATED") or after fetching data; modules that render only via a hidden/child element but still call updateDom.
Related errors
AI-assisted analysis of MagicMirrorOrg/MagicMirror@4b4a59534f (2026-08-31).
Data as JSON: /api/errors/ff61123ca62382ec.
Report an issue: GitHub.