Closed denhaandrei closed 1 year ago
Hi @denhaandrei, thanks for reaching our πͺ I can confirm that this is an issue not only on v10.3.2 but also on previous major Umbraco versions, so the problem has been there for a while... π€· The steps I used to reproduce are the ones specified but some additional clarification is needed, so we don't confuse it with a concept in Umbraco called Nested content. π
Note β : This is an issue that has been reported in the past (https://github.com/umbraco/Umbraco-CMS/issues/8033) and there were some attempts to fix it (https://github.com/umbraco/Umbraco-CMS/pull/8158). Based on my investigation, I would provide some nodes and mark it as up-for-grabs for now π |
---|
The issue is about creating a Content node with nested Content nodes (descendants), sorting them and copying the parent Content node - as a result, the sorted order of the copied content nodes is not persisted. In other words:
"TestSort"
1.1. Under Permissions add the same Document type as "Allowed child node types" of TestSort"Parent item"
Nested item B Nested item A Nested item C
"Nested item B"
β order is important:
Nested Nested Item II Nested Nested Item I Nested Nested Item III
Nested item A Nested item B Nested item C
Nested Nested Item I Nested Nested Item II Nested Nested Item III
We should end up with the following structure:
βοΈ Sorted items on the left; Copied items on the right βοΈ
Looking at the database (umbracoNode
table), we can see the problem in the sortOrder
column. The first 3 highlighted items are the original ones and the order is sorted as per the steps above, while the other 3 are the copied nodes and there the order is reset back in accordance to their creation date.
Inspecting the code, it seems like the descendantCopy
has the order correctly (ln.2719) but after we save it using _documentRepository.Save(descendantCopy)
(ln.2739) the order is back to their creation order.
https://github.com/umbraco/Umbraco-CMS/blob/4df012e8e9bc7bf3131791b15b4a41ebc63c4abe/src/Umbraco.Core/Services/ContentService.cs#L2719-L2739
An idea could be to pass on the entity.SortOrder
to nodeDto.SortOrder
, instead of getting it from GetNewChildSortOrder()
but we have to test out if other changes are necesary.
π΄ Things to watch out for:
I am working on this
Hi there, thank you so much for solving this issue in Umbraco 10+.
My team at work are currently using Umbraco 8 for an application we have inherited from another client, and have currently encountered this issue as well.
I was hoping to see if our team could backport this fix to Umbraco 8, but it appears the fix in the linked PR relies on some features introduced in Umbraco 9.
If we wanted to backport this to Umbraco 8, are there any pointers or suggestions on what we should look to do that you guys could suggest? (even a slightly hacky solution will work).
Which Umbraco version are you using? (Please write the exact version, example: 10.1.0)
10.3.2
Bug summary
Hi, I'm using late Umbraco 10 and my content editors asked me if there's any possible way to copy nested content items with sorting preserved when they copy their parent item.
For example, when I copy an item with the structure:
I will get a new item:
Specifics
Please note, it reproduce for all Umbraco version 10
Steps to reproduce
Expected result / actual result
Actual Result: The content copied as created without applying new sorting:
Expected Result: The content copied with the actual applying sorting: