Frontmatter
| id | 8617 |
| title | Refactor StringBasedRenderer for API Parity (Separate Creation from Insertion) |
| state | Closed |
| labels | airefactoringcore |
| assignees | tobiu |
| createdAt | Jan 13, 2026, 8:53 PM |
| updatedAt | Jan 14, 2026, 12:11 AM |
| githubUrl | https://github.com/neomjs/neo/issues/8617 |
| author | tobiu |
| commentsCount | 1 |
| parentIssue | 8601 |
| subIssues | [] |
| subIssuesCompleted | 0 |
| subIssuesTotal | 0 |
| blockedBy | [] |
| blocking | [] |
| closedAt | Jan 14, 2026, 12:10 AM |
Refactor StringBasedRenderer for API Parity (Separate Creation from Insertion)
tobiu added parent issue #8601 on Jan 13, 2026, 8:54 PM
tobiu assigned to @tobiu on Jan 13, 2026, 8:59 PM
tobiu closed this issue on Jan 14, 2026, 12:10 AM

tobiu
Jan 14, 2026, 12:11 AM
Input from Gemini 3 Pro:
✦ Refactored
StringBasedRendererto exposecreateNode({outerHTML}), aligning it with theDomApiRenderercreation pattern.Critical Fixes & verification:
- Unified Insertion:
DeltaUpdates.insertNodenow uses a consistent creation-then-insertion flow for both renderers.- Scroll State Preservation: Fixed a bug where
DomApiRendererlost scroll state during insertion. Implemented a unifiedpostMountUpdateshandler that supports both node-reference (DomApi) and ID-lookup (StringBased) formats.- Refactoring: Removed unused
insertNodeAsStringandhtmlStringToElement, consolidating logic intocreateNode.- Testing: Added regression tests in
FragmentDeltaUpdates.spec.mjsverifyingscrollToppreservation for bothDomApiRendererandStringBasedRenderer.
During Fragment implementation, it was noted that
StringBasedRenderer.insertNodeAsStringhandles both creation (from string) and insertion (into parent), whereasDomApiRenderer.createDomTreereturns the node for the caller to insert. This inconsistency forcedDeltaUpdatesto bypassinsertNodeAsStringand usehtmlStringToElementdirectly for Fragments.Goal: Refactor
StringBasedRendererto expose acreateNode(or similar) method that returns aDocumentFragment/Elementfrom the delta, and updateDeltaUpdatesto handle the insertion step uniformly for both renderers. This improves code reuse and maintainability.