We have moved to GitHub Issues
Created by Damiaan Peeters 20 May 2015, 11:03:59 Updated by Stephan 16 Jun 2015, 16:27:32
We see sometimes unpredictable order from IPublishedContent nodes. They tend to switch magically. Also, new nodes are not added at the end of the children.
The reason why new nodes are not attached as the end of the list has to do with the "sortOrder" containing duplicate (or missing) items. The way to solve this is to "Sort" the items manually. After this action the new nodes will be created at the end of the list again and magical switching of nodes on the frond-end will stop.
To reproduce this issue, start a clean Umbraco. Create a home node with 3 childnodes. Delete the second child node. And add a new child node. The sortOrder will contain now 0,2,2.
Concerning the expected result, I expected it to be 0,2,3 or 0,1,2. Not containing duplicate sortOrder values.
ContentRepository.PersistNewItem() gets the sort order of any new node via:
var sortOrder =
effectively setting the sort order to (number-of-children + 1). Meanwhile, ContentRepository.PersistDeletedItem() removes the deleted node without making any change to its siblings sort order.
So... if we do not want to reorder all children, PersistNewItem should set the sort order to (max(siblings-sort-order) + 1).
pull request: https://github.com/umbraco/Umbraco-CMS/pull/710
(pull request beeing discussed)
(pull request merged)
Backwards Compatible: True
Fix Submitted: Pull request
Affected versions: 7.1.8, 7.2.4, 7.2.5, 7.2.6
Due in version: 7.3.0