Sort the children of a parent node after either deleting or moving a child node#17315
Sort the children of a parent node after either deleting or moving a child node#17315georgebid merged 1 commit intoumbraco:contribfrom
Conversation
… its child content
|
Hi there @manutdkid77, thank you for this contribution! 👍 While we wait for one of the Core Collaborators team to have a look at your work, we wanted to let you know about that we have a checklist for some of the things we will consider during review:
Don't worry if you got something wrong. We like to think of a pull request as the start of a conversation, we're happy to provide guidance on improving your contribution. If you realize that you might want to make some changes then you can do that by adding new commits to the branch you created for this work and pushing new commits. They should then automatically show up as updates to this pull request. Thanks, from your friendly Umbraco GitHub bot 🤖 🙂 |
|
@manutdkid77 thanks a lot for your PR to fix the issue #17273 One of us Core Collabs team will review it soon 🙌 |
|
Hi there @manutdkid77! Thanks again and sorry for the delay, we'll get to it! Just a hint: as you may know, this PR qualifies for Umbraco's Hacktoberfest participation for which you can earn rewards. |
|
Thank you @nul800sebastiaan , I'll look to contribute another one 🙂 |
|
Hey, @manutdkid77 thanks again for your PR! This has now been tested and works as expected - therefore I have merged this in 😄 |
|
Hey there @manutdkid77! Thanks for the contribution and I'm sorry to have to do this, but I have reverted (b00c84a) this merge. The solution is (almost) never to do a sort operation. Sorting can be a heavy operation and it is entirely possible that you'll accidentally end up sorting (and re-sorting and re-sorting) hundreds, thousands, or more nodes in the database which can lead to a huge performance bottleneck. You had the cause of the issue narrowed down pretty closely but you should have checked what was actually happening in the database. Node B actually has a perfectly fine As you can see, this query works: However, the actual query that is being sent in uses the lower case for This yields no results and therefore I can update the query by casting the column result and the value to But I don't know if that's the correct solution, I'm going to have to get some input from the team. |
|
FYI: my team member Sven made a new PR for this: #17517 |
|
Hi there @manutdkid77! First of all: A big #H5YR for making an Umbraco related contribution during Hacktoberfest! We are very thankful for the huge amount of PRs submitted, and all the amazing work you've been doing 🥇 Due to the amazing work you and others in the community have been doing, we've had a bit of a hard time keeping up. 😅 While all of the PRs for Hacktoberfest might not have been merged yet, you still qualify for receiving some Umbraco swag, congratulations! 🎉 In the spirit of Hacktoberfest we've prepared some exclusive Umbraco swag for all our contributors - including you! As an alternative choice, you can opt-out of receiving anything and ask us to help improve the planet instead by planting a tree on your behalf. 🌳 Receive your swag or plant a tree! 👈 Please follow this link to fill out and submit the form, before December 25th, 2024, 23:59:00 UTC. Following this date we'll be sending out all the swag, but please note that it might not reach your doorstep for a few weeks/months, so please bear with us and be patient 🙏 The only thing left to say is thank you so much for participating in Hacktoberfest! We really appreciate the help! Kind regards, |
|
@nul800sebastiaan No worries, you are absolutely right. I should have considered the performance implications, especially when working on a large content tree. Thank you for the detailed explanation, it has helped me understand more about how the sorting works behind the scenes. 🙂 |




Prerequisites
This fixes #17273
Description
node Ais created under a parent node, it is assigned a SortOrder value of 0.node Bunder the parenr node, it is assigned a SortOrder value of 1.node Anode C, here the SortOrderExists looks to find any item with sortOrder as 0.SortOrderExistscan't find such an item with SortOrder as 0, so it returns false, and this results in setting the SortOrder as 0