Frontmatter
| id | 8471 |
| title | Refactor afterSetId in src/button/Base.mjs |
| state | Closed |
| labels | airefactoringcore |
| assignees | tobiu |
| createdAt | Jan 9, 2026, 4:51 PM |
| updatedAt | Jan 9, 2026, 5:09 PM |
| githubUrl | https://github.com/neomjs/neo/issues/8471 |
| author | tobiu |
| commentsCount | 1 |
| parentIssue | 8469 |
| subIssues | [] |
| subIssuesCompleted | 0 |
| subIssuesTotal | 0 |
| blockedBy | [] |
| blocking | [] |
| closedAt | Jan 9, 2026, 5:09 PM |
Refactor afterSetId in src/button/Base.mjs
tobiu assigned to @tobiu on Jan 9, 2026, 5:07 PM

tobiu
Jan 9, 2026, 5:07 PM
Input from Gemini 3 Pro:
✦ Refactored
src/button/Base.mjsto useensureStableIdsinstead ofafterSetId. This prevents_vdomprototype mutation by ensuring the ID injection happens during themergeConfigphase where a fresh instance clone is guaranteed.Verified with a new unit test in
test/playwright/unit/button/Base.spec.mjs.
tobiu added parent issue #8469 on Jan 9, 2026, 5:09 PM
tobiu closed this issue on Jan 9, 2026, 5:09 PM
tobiu cross-referenced by #8469 on Jan 9, 2026, 5:09 PM
The current implementation of
afterSetIdinsrc/button/Base.mjsmutates the class prototype's_vdomwhen called during the construction phase (beforeinitConfigclones the VDOM).Current Code:
afterSetId(value, oldValue) { super.afterSetId(value, oldValue); this.textNode.id = value + '__text'; }Proposed Change:
textNode.idassignment to an override ofensureStableIds().ensureStableIds()is called byComponent.Base#mergeConfigafter_vdomhas been cloned for the instance, ensuring safety.afterSetId(or make it conditional, butComponent.BasehandlesensureStableIdson ID change if configs applied, so overridingensureStableIdshandles both init and update cases).Goals:
textNodeIDs are stable and unique per instance.