{"record":{"id":"ff61123ca62382ec","repo":"MagicMirrorOrg/MagicMirror","slug":"module-tries-to-update-the-dom-without-being-displ","errorCode":null,"errorMessage":"module tries to update the DOM without being displayed.","messagePattern":"module tries to update the DOM without being displayed\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"js/main.js","lineNumber":664,"sourceCode":"\t\t}\n\n\t\t// Further implementation is done in the private method.\n\t\t_sendNotification(notification, payload, sender);\n\t},\n\n\t/**\n\t * Update the dom for a specific module.\n\t * @param {Module} module The module that needs an update.\n\t * @param {object|number} [updateOptions] The (optional) number of microseconds for the animation or object with updateOptions (speed/animates)\n\t */\n\tasync updateDom (module, updateOptions) {\n\t\tif (!(module instanceof Module)) {\n\t\t\tLog.error(\"updateDom: Sender should be a module.\");\n\t\t\treturn;\n\t\t}\n\n\t\tif (!module.data.position) {\n\t\t\tLog.warn(\"module tries to update the DOM without being displayed.\");\n\t\t\treturn;\n\t\t}\n\n\t\t// Further implementation is done in the private method.\n\t\tawait _updateDom(module, updateOptions);\n\t\t// Once the update is complete and rendered, send a notification to the module that the DOM has been updated\n\t\t_sendNotification(\"MODULE_DOM_UPDATED\", null, null, module);\n\t},\n\n\t/**\n\t * Returns a collection of all modules currently active.\n\t * @returns {Module[]} A collection of all modules currently active.\n\t */\n\tgetModules () {\n\t\tsetSelectionMethodsForModules(modules);\n\t\treturn modules;\n\t},\n","sourceCodeStart":646,"sourceCodeEnd":682,"githubUrl":"https://github.com/MagicMirrorOrg/MagicMirror/blob/4b4a59534f7da01e4030e46029fe9dd649a7675e/js/main.js#L646-L682","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before (config.js)\n{ module: \"compliments\", config: { ... } }\n// after\n{ module: \"compliments\", position: \"lower_third\", config: { ... } }","handlingStrategy":"type-guard","validationCode":"// config.js sanity check before starting:\n// every module entry that calls updateDom must declare position\nrequire('./js/check_config.js') // or: npm run config:check","typeGuard":"function hasPosition (module) {\n  return module instanceof Module && typeof module.data.position === \"string\" && module.data.position.length > 0;\n}\nif (hasPosition(myModule)) myModule.sendNotification(\"DOM_OBJECTS_CREATED\");","tryCatchPattern":null,"preventionTips":["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)"],"tags":["dom","module-config","position"],"backgroundTag":"module-missing-position","analyzedSha":"4b4a59534f7da01e4030e46029fe9dd649a7675e","analyzedAt":"2026-08-31T21:49:42.591Z","schemaVersion":2},"datasetVersion":"2026-08-31T22:30:34.772Z"}