Frontmatter
| id | 8626 |
| title | Container.insert() should be a no-op for same-index moves |
| state | Closed |
| labels | bugaicore |
| assignees | tobiu |
| createdAt | Jan 14, 2026, 1:15 AM |
| updatedAt | Jan 14, 2026, 1:27 AM |
| githubUrl | https://github.com/neomjs/neo/issues/8626 |
| author | tobiu |
| commentsCount | 1 |
| parentIssue | 8601 |
| subIssues | [] |
| subIssuesCompleted | 0 |
| subIssuesTotal | 0 |
| blockedBy | [] |
| blocking | [] |
| closedAt | Jan 14, 2026, 1:27 AM |
Container.insert() should be a no-op for same-index moves
tobiu added parent issue #8601 on Jan 14, 2026, 1:16 AM
tobiu assigned to @tobiu on Jan 14, 2026, 1:25 AM

tobiu
Jan 14, 2026, 1:27 AM
Input from Gemini 3 Pro:
✦ I have implemented the no-op check in
Neo.container.Base.insert()to prevent unnecessary VDOM updates when inserting an item into its current position. I also refactored the method to reduce redundant calls toNeo.typeOfanditem.parent.The changes were committed in
6ad5eaf3b(mistakenly referenced as #8627 in the commit message).Changes committed and pushed.
tobiu closed this issue on Jan 14, 2026, 1:27 AM
tobiu cross-referenced by #8616 on Jan 14, 2026, 1:51 AM
tobiu cross-referenced by #8625 on Jan 14, 2026, 1:59 AM
Currently,
Neo.container.Base.insert(index, item)does not check if theitemis already at the specifiedindexwithin the same container. It proceeds to remove and re-insert the item, which triggers unnecessary VDOM updates and potentially destabilizes complex components (like Fragments) or focus state.Goal: Modify
Neo.container.Base.insert()to detect this condition and return early (no-op) if the item is already at the target index.Logic:
if (item.parent === this && this.items.indexOf(item) === index) { return item; }Impact: