Skip to content

refactor(main): modernize DOM update flow with async/await#4186

Merged
khassel merged 1 commit into
MagicMirrorOrg:developfrom
KristjanESPERANTO:then
Jun 16, 2026
Merged

refactor(main): modernize DOM update flow with async/await#4186
khassel merged 1 commit into
MagicMirrorOrg:developfrom
KristjanESPERANTO:then

Conversation

@KristjanESPERANTO

Copy link
Copy Markdown
Collaborator

Follow-up to #4185. This PR replaces .then()/.catch() chains in the DOM update flow with async/await, making the code easier to read and reason about.

What changed:

  • createDomObjects and MM.updateDom are now async, the nested .then() callbacks are gone
  • Extracted a small createModuleDom() helper to keep the loop in createDomObjects readable
  • Errors in createDomObjects are caught in a single try/catch - before, a failing module could cause an unhandled Promise rejection
  • updateDomWithContent now properly awaits the full show animation before resolving. The old code called resolve() while the animation was still running, which was technically wrong
  • Fixed @param {Promise} callback in JSDoc - it's not a Promise, it's a plain () => void function

@khassel khassel merged commit 9d315e1 into MagicMirrorOrg:develop Jun 16, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants