From f286b1168ce587952f7e858189e031fd0921db9e Mon Sep 17 00:00:00 2001 From: Kenn Jacobsen Date: Fri, 17 Nov 2023 10:26:59 +0100 Subject: [PATCH] Ensure content types are updated in ContentStore when a data type changes (#15239) --- src/Umbraco.PublishedCache.NuCache/ContentStore.cs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/Umbraco.PublishedCache.NuCache/ContentStore.cs b/src/Umbraco.PublishedCache.NuCache/ContentStore.cs index fad8722b77db..f38b9dd2fc2f 100644 --- a/src/Umbraco.PublishedCache.NuCache/ContentStore.cs +++ b/src/Umbraco.PublishedCache.NuCache/ContentStore.cs @@ -736,16 +736,22 @@ public void UpdateDataTypesLocked(IEnumerable dataTypeIds, Func kvp.Value.Value != null && kvp.Value.Value.PropertyTypes.Any(p => dataTypeIds.Contains(p.DataType.Id))) .Select(kvp => kvp.Value.Value) .Select(x => getContentType(x!.Id)) - .Where(x => x != null) // poof, gone, very unlikely and probably an anomaly + .WhereNotNull() // poof, gone, very unlikely and probably an anomaly .ToArray(); - var contentTypeIdsA = contentTypes.Select(x => x!.Id).ToArray(); + // all content types that are affected by this data type update must be updated + foreach (IPublishedContentType contentType in contentTypes) + { + SetContentTypeLocked(contentType); + } + + var contentTypeIdsA = contentTypes.Select(x => x.Id).ToArray(); var contentTypeNodes = new Dictionary>(); foreach (var id in contentTypeIdsA) { @@ -761,7 +767,7 @@ public void UpdateDataTypesLocked(IEnumerable dataTypeIds, Func