Frontmatter
| id | 8805 |
| title | Harden Core Components against Async Destruction |
| state | Closed |
| labels | bugaicore |
| assignees | tobiu |
| createdAt | Jan 19, 2026, 12:06 PM |
| updatedAt | Jan 19, 2026, 12:18 PM |
| githubUrl | https://github.com/neomjs/neo/issues/8805 |
| author | tobiu |
| commentsCount | 1 |
| parentIssue | null |
| subIssues | [] |
| subIssuesCompleted | 0 |
| subIssuesTotal | 0 |
| blockedBy | [] |
| blocking | [] |
| closedAt | Jan 19, 2026, 12:18 PM |
Harden Core Components against Async Destruction
tobiu assigned to @tobiu on Jan 19, 2026, 12:18 PM

tobiu
Jan 19, 2026, 12:18 PM
Input from Gemini 3 Pro:
✦ I have hardened the core framework components against asynchronous destruction to prevent memory leaks and runtime errors.
Summary of Changes:
src/container/Base.mjs:
- Hardened
loadItems()by wrappingfetch,response.json(), and dynamic imports withthis.trap(). This ensures that if the container is destroyed while loading items, the operation is safely cancelled.
src/form/field/FileUpload.mjs:
- Wrapped
fetchcalls indeleteDocument()andcheckDocumentStatus()withthis.trap().- Implemented a
destroy()method to explicitly abort any active XHR uploads (this.xhr.abort()).- Added checks for
this.isDestroyedin all XHR event handlers (onUploadProgress,onUploadAbort,onUploadError,onUploadDone) to prevent execution on dead instances.
src/component/Circle.mjs&src/component/Helix.mjs:
- Refactored
loadData()to useasync/await.- Wrapped the
Neo.Xhr.promiseJson()call withthis.trap().- Added error handling to specifically suppress logging if the error is
Neo.isDestroyed.Verification:
I created and ran a comprehensive suite of Playwright unit tests to verify these fixes:
test/playwright/unit/container/AsyncLoadItems.spec.mjs: VerifiesloadItemsrejection on destruction.test/playwright/unit/form/field/FileUploadAsync.spec.mjs: VerifiesdeleteDocumentrejection on destruction.test/playwright/unit/component/CircleAsync.spec.mjs: VerifiesloadDatarejection on destruction.All 8 tests (including the core infrastructure tests) passed successfully.
tobiu closed this issue on Jan 19, 2026, 12:18 PM
Goal: Harden Core Framework Components against asynchronous destruction to prevent memory leaks and runtime errors when a component is destroyed while an async operation (fetch, XHR) is pending.
Scope:
src/container/Base.mjs: HardeningloadItems().src/form/field/FileUpload.mjs: HardeningdeleteDocument(),checkDocumentStatus()andupload()(XHR).src/component/Circle.mjs: RefactoringafterSetUrlto async/await +trap().src/component/Helix.mjs: RefactoringafterSetUrlto async/await +trap().Implementation Details:
this.trap(promise)to wrapfetchorNeo.Xhrcalls.async/awaitover.then().