Skip to content

Commit e42f98f

Browse files
Avoid DocTypeGridEditors returning duplicate block configurations for the same content element type
1 parent bdda86e commit e42f98f

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/Umbraco.Deploy.Contrib/Migrators/ReplaceDocTypeGridEditorDataTypeArtifactMigrator.cs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,20 +59,25 @@ public ReplaceDocTypeGridEditorDataTypeArtifactMigrator(PropertyEditorCollection
5959

6060
// Migrate DTGE editors
6161
var allElementTypes = GetAllElementTypes().ToList();
62+
var migratedContentTypeKeys = new HashSet<Guid>();
6263
foreach (IGridEditorConfig gridEditor in GetGridEditors(gridLayouts).Where(IsDocTypeGridEditor))
6364
{
6465
foreach (Guid contentElementTypeKey in MigrateDocTypeGridEditor(gridEditor, allElementTypes))
6566
{
66-
yield return (gridEditor.Alias, new BlockGridBlockConfiguration()
67+
// Avoid DocTypeGridEditors returning duplicate block configurations for the same content element type
68+
if (migratedContentTypeKeys.Add(contentElementTypeKey))
6769
{
68-
ContentElementTypeKey = contentElementTypeKey,
69-
Label = gridEditor.Config.TryGetValue("nameTemplate", out var nameTemplateConfig) && nameTemplateConfig is string nameTemplate && !string.IsNullOrEmpty(nameTemplate)
70+
yield return (gridEditor.Alias, new BlockGridBlockConfiguration()
71+
{
72+
ContentElementTypeKey = contentElementTypeKey,
73+
Label = gridEditor.Config.TryGetValue("nameTemplate", out var nameTemplateConfig) && nameTemplateConfig is string nameTemplate && !string.IsNullOrEmpty(nameTemplate)
7074
? nameTemplate
7175
: gridEditor.NameTemplate,
72-
EditorSize = gridEditor.Config.TryGetValue("overlaySize", out var overviewSizeConfig) && overviewSizeConfig is string overviewSize && !string.IsNullOrEmpty(overviewSize)
76+
EditorSize = gridEditor.Config.TryGetValue("overlaySize", out var overviewSizeConfig) && overviewSizeConfig is string overviewSize && !string.IsNullOrEmpty(overviewSize)
7377
? overviewSize
7478
: null,
75-
});
79+
});
80+
}
7681
}
7782
}
7883
}

0 commit comments

Comments
 (0)