LearnNewsExamplesServices
Frontmatter
id8802
titleExtend async destruction handling to VdomLifecycle and Component
stateClosed
labels
enhancementaiarchitecturecore
assigneestobiu
createdAtJan 19, 2026, 11:29 AM
updatedAtJan 19, 2026, 11:46 AM
githubUrlhttps://github.com/neomjs/neo/issues/8802
authortobiu
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtJan 19, 2026, 11:45 AM

Extend async destruction handling to VdomLifecycle and Component

Closed v11.23.0 enhancementaiarchitecturecore
tobiu
tobiu commented on Jan 19, 2026, 11:29 AM

Extend the Neo.isDestroyed rejection pattern introduced in #8801.

Plan:

  1. Refactor core.Base:
    • Rename #timeouts to #asyncRejects.
    • Add registerAsync(id, reject) and unregisterAsync(id).
    • Add trap(promise) helper to wrap external promises (like remote calls).
    • Update timeout to use new methods.
  2. Update mixin.VdomLifecycle:
    • Refactor promiseUpdate to register its reject function.
  3. Update component.Base:
    • Refactor getDomRect to use this.trap().
    • Refactor measure to use this.trap().

This ensures await component.promiseUpdate() and await component.getDomRect() correctly throw Neo.isDestroyed if the component is destroyed during the operation.

tobiu added the enhancement label on Jan 19, 2026, 11:29 AM
tobiu added the ai label on Jan 19, 2026, 11:29 AM
tobiu added the architecture label on Jan 19, 2026, 11:29 AM
tobiu added the core label on Jan 19, 2026, 11:29 AM
tobiu referenced in commit 904ca29 - "feat: Extend async destruction handling to VdomLifecycle and Component (#8802)" on Jan 19, 2026, 11:44 AM
tobiu
tobiu Jan 19, 2026, 11:44 AM

Input from Gemini 3 Pro:

✦ I have extended the async destruction handling pattern to VdomLifecycle and Component.

Changes:

  1. src/core/Base.mjs:
    • Renamed #timeouts to #asyncRejects.
    • Added registerAsync, unregisterAsync, and trap to manage generic cancellable promises.
  2. src/mixin/VdomLifecycle.mjs:
    • Updated promiseUpdate() to use the new registration system.
  3. src/component/Base.mjs:
    • Updated getDomRect() and measure() to use this.trap().
  4. Tests:
    • Added test/playwright/unit/core/AsyncDestruction.spec.mjs to verify the new behavior.

Verification: Unit tests confirm that these methods now correctly reject with Neo.isDestroyed if the component is destroyed during execution.

tobiu closed this issue on Jan 19, 2026, 11:45 AM
tobiu assigned to @tobiu on Jan 19, 2026, 11:46 AM