Frontmatter
| id | 8614 |
| title | Fix moveNode off-by-one error for forward moves in same parent |
| state | Closed |
| labels | bugaicore |
| assignees | tobiu |
| createdAt | Jan 13, 2026, 8:25 PM |
| updatedAt | Jan 13, 2026, 8:41 PM |
| githubUrl | https://github.com/neomjs/neo/issues/8614 |
| author | tobiu |
| commentsCount | 1 |
| parentIssue | 8601 |
| subIssues | [] |
| subIssuesCompleted | 0 |
| subIssuesTotal | 0 |
| blockedBy | [] |
| blocking | [] |
| closedAt | Jan 13, 2026, 8:41 PM |
Fix moveNode off-by-one error for forward moves in same parent
tobiu assigned to @tobiu on Jan 13, 2026, 8:26 PM
tobiu added parent issue #8601 on Jan 13, 2026, 8:26 PM

tobiu
Jan 13, 2026, 8:41 PM
Input from Gemini 3 Pro:
✦ Fixed the off-by-one error in
DeltaUpdates.moveNodeby adjusting index for same-parent forward moves. Also fixedApp.moveComponentto correctly invokeremove(item, false, true)(Silent) to prevent double updates during moves, ensuring atomicmoveNodedeltas. Verified withFragmentLifecycle.spec.mjs.
tobiu closed this issue on Jan 13, 2026, 8:41 PM
When moving a node forward within the same physical parent,
DeltaUpdates.moveNodefails to account for the node's current position affectingchildNodesindices. Test case:['A', 'B', 'C']. Move 'A' to index 2 (after C).childNodes[2]is 'C'.insertBefore(A, C)results in['B', 'A', 'C']. Expected:['B', 'C', 'A'].Fix: In
Neo.main.DeltaUpdates.moveNode: Ifnode.parentNode === parentNode(moving within same parent) ANDcurrentIndex < index(moving forward), increment the lookup index forsiblingRef(or check ifindex >= length - 1for append).