Nested content optimizations (#10236)

* Reducing the large amount of objects allocated and make use of the attemped dictionary cache

* Reverting optimization by passing data from a higher level - not really possible to achieve what we wanted and adding faster way to lookup value editors

(cherry picked from commit 897cb11f00)
This commit is contained in:
Elitsa Marinovska
2021-06-29 09:55:02 +02:00
committed by Sebastiaan Janssen
parent 31e9c875f5
commit 3e89e46840

View File

@@ -156,6 +156,7 @@ namespace Umbraco.Web.PropertyEditors
public override object ToEditor(Property property, IDataTypeService dataTypeService, string culture = null, string segment = null)
{
var val = property.GetValue(culture, segment);
var valEditors = new Dictionary<int, IDataValueEditor>();
var rows = _nestedContentValues.GetPropertyValues(val);
@@ -184,8 +185,15 @@ namespace Umbraco.Web.PropertyEditors
continue;
}
var tempConfig = dataTypeService.GetDataType(prop.Value.PropertyType.DataTypeId).Configuration;
var valEditor = propEditor.GetValueEditor(tempConfig);
var dataTypeId = prop.Value.PropertyType.DataTypeId;
if (!valEditors.TryGetValue(dataTypeId, out var valEditor))
{
var tempConfig = dataTypeService.GetDataType(dataTypeId).Configuration;
valEditor = propEditor.GetValueEditor(tempConfig);
valEditors.Add(dataTypeId, valEditor);
}
var convValue = valEditor.ToEditor(tempProp, dataTypeService);
// update the raw value since this is what will get serialized out