Skip to content

refactor(main): simplify updateDomWithContent async flow#4182

Merged
khassel merged 1 commit into
MagicMirrorOrg:developfrom
KristjanESPERANTO:updateDomWithContent
Jun 7, 2026
Merged

refactor(main): simplify updateDomWithContent async flow#4182
khassel merged 1 commit into
MagicMirrorOrg:developfrom
KristjanESPERANTO:updateDomWithContent

Conversation

@KristjanESPERANTO

Copy link
Copy Markdown
Collaborator

This keeps the same behavior, but makes the function easier to read.

  • moved to async/await with early returns
  • kept only one small Promise wrapper around the _hideModule callback
  • removed a duplicate speed check
  • cleaned up JSDoc so timing/return details are clearer

No runtime change intended; hide/show sequencing stays the same.

@khassel khassel merged commit e747db1 into MagicMirrorOrg:develop Jun 7, 2026
12 checks passed
@KristjanESPERANTO KristjanESPERANTO deleted the updateDomWithContent branch June 7, 2026 21:23
khassel pushed a commit that referenced this pull request Jun 12, 2026
`_updateDom` was wrapping its entire body in a `new Promise(resolve =>
{...})` constructor just to chain `getDom()` and
`updateDomWithContent()` together. Since `updateDomWithContent` was
already converted to async in #4182, we can now just `await` it directly
- the manual wrapper, the explicit `Promise.resolve()` normalization,
and the nested `.then().catch()` chain all become unnecessary, making
the control flow easier to follow.
Also added `.catch(Log.error)` at both call sites, since async functions
reject on error instead of swallowing it silently.
KristjanESPERANTO added a commit to KristjanESPERANTO/MagicMirror that referenced this pull request Jun 12, 2026
…4185)

`_updateDom` was wrapping its entire body in a `new Promise(resolve =>
{...})` constructor just to chain `getDom()` and
`updateDomWithContent()` together. Since `updateDomWithContent` was
already converted to async in MagicMirrorOrg#4182, we can now just `await` it directly
- the manual wrapper, the explicit `Promise.resolve()` normalization,
and the nested `.then().catch()` chain all become unnecessary, making
the control flow easier to follow.
Also added `.catch(Log.error)` at both call sites, since async functions
reject on error instead of swallowing it silently.
KristjanESPERANTO added a commit to KristjanESPERANTO/MagicMirror that referenced this pull request Jun 12, 2026
…4185)

`_updateDom` was wrapping its entire body in a `new Promise(resolve =>
{...})` constructor just to chain `getDom()` and
`updateDomWithContent()` together. Since `updateDomWithContent` was
already converted to async in MagicMirrorOrg#4182, we can now just `await` it directly
- the manual wrapper, the explicit `Promise.resolve()` normalization,
and the nested `.then().catch()` chain all become unnecessary, making
the control flow easier to follow.
Also added `.catch(Log.error)` at both call sites, since async functions
reject on error instead of swallowing it silently.
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