Fix issue - changing a document type broke the nucache data structure (#12209)

(cherry picked from commit 15df448274edb291ae568148c61baa7541615247)
This commit is contained in:
Paul Johnson
2022-04-06 08:42:10 +01:00
committed by GitHub
parent ad51832b5d
commit 80c90f23d1

View File

@@ -443,10 +443,18 @@ namespace Umbraco.Cms.Infrastructure.PublishedCache
refreshedIdsA.Contains(x.ContentTypeId) &&
BuildKit(x, out _)))
{
// replacing the node: must preserve the parents
// replacing the node: must preserve the relations
var node = GetHead(_contentNodes, kit.Node.Id)?.Value;
if (node != null)
{
// Preserve children
kit.Node.FirstChildContentId = node.FirstChildContentId;
kit.Node.LastChildContentId = node.LastChildContentId;
// Also preserve siblings
kit.Node.NextSiblingContentId = node.NextSiblingContentId;
kit.Node.PreviousSiblingContentId = node.PreviousSiblingContentId;
}
SetValueLocked(_contentNodes, kit.Node.Id, kit.Node);