Frontmatter
| id | 8478 |
| title | Refactor afterSetId in Form Fields to ensureStableIds |
| state | Closed |
| labels | airefactoringcore |
| assignees | tobiu |
| createdAt | Jan 9, 2026, 6:20 PM |
| updatedAt | Jan 9, 2026, 6:25 PM |
| githubUrl | https://github.com/neomjs/neo/issues/8478 |
| author | tobiu |
| commentsCount | 1 |
| parentIssue | 8469 |
| subIssues | [] |
| subIssuesCompleted | 0 |
| subIssuesTotal | 0 |
| blockedBy | [] |
| blocking | [] |
| closedAt | Jan 9, 2026, 6:25 PM |
Refactor afterSetId in Form Fields to ensureStableIds
tobiu added parent issue #8469 on Jan 9, 2026, 6:21 PM
tobiu assigned to @tobiu on Jan 9, 2026, 6:24 PM

tobiu
Jan 9, 2026, 6:24 PM
Input from Gemini 3 Pro:
✦ I have refactored
afterSetIdtoensureStableIdsin:
src/form/field/CheckBox.mjssrc/form/field/FileUpload.mjssrc/form/field/Text.mjsChanges:
- Replaced
afterSetIdwithensureStableIds.- ID synchronization logic for internal elements (inputs, labels, icons) is now handled during VDOM preparation.
- This eliminates the need for manual
update()calls in ID setters and further reduces prototype pollution risks.Verification:
- Added
test/playwright/unit/form/field/IdSync.spec.mjs.- Verified that all internal node IDs (e.g.
__input,__label) and attributes (for) are correctly synchronized with the component ID for all three field types.Commit: 91085ea4f (#8478)
tobiu closed this issue on Jan 9, 2026, 6:25 PM
Context:
src/form/field/CheckBox.mjs,src/form/field/FileUpload.mjs, andsrc/form/field/Text.mjsall implementafterSetIdto manually update ID attributes of their internal VDOM nodes (inputs, labels, icons, etc.). This pattern is consistent across these form fields.Goal: Refactor
afterSetIdintoensureStableIdsfor all three files. This will:constructfix but still cleaner).ensureStableIds.Files:
src/form/field/CheckBox.mjs:label,input,icon,valueLabelIDs.src/form/field/FileUpload.mjs:inputID.src/form/field/Text.mjs:input,labelIDs.Verification:
test/playwright/unit/form/field/IdSync.spec.mjs.