Ensure the default segment is always included in API responses (#19126)

This commit is contained in:
Kenn Jacobsen
2025-04-24 09:46:30 +02:00
committed by GitHub
parent 80bf2314c6
commit 1dd5fe3cbc

View File

@@ -56,7 +56,8 @@ public abstract class ContentMapDefinition<TContent, TValueViewModel, TVariantVi
{
IPropertyValue[] propertyValues = source.Properties.SelectMany(propertyCollection => propertyCollection.Values).ToArray();
var cultures = source.AvailableCultures.DefaultIfEmpty(null).ToArray();
var segments = propertyValues.Select(property => property.Segment).Distinct().DefaultIfEmpty(null).ToArray();
// the default segment (null) must always be included in the view model - both for variant and invariant documents
var segments = propertyValues.Select(property => property.Segment).Union([null]).Distinct().ToArray();
return cultures
.SelectMany(culture => segments.Select(segment =>