Skip to content

Commit a65388f

Browse files
committed
Add comment, revert testing code
1 parent 0f89250 commit a65388f

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/Our.Umbraco.GraphQL/Adapters/PublishedContent/Types/PublishedPropertyFieldType.cs

+4-5
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ public PublishedPropertyFieldType(IPublishedContentType contentType, PropertyTyp
3030
unwrappedTypeInfo = typeof(IPublishedElement).GetTypeInfo();
3131

3232
var propertyGraphType = typeRegistry.Get(unwrappedTypeInfo) ?? typeof(StringGraphType).GetTypeInfo();
33+
// The Grid data type declares its return type as a JToken, but is actually a JObject. The result is that without this check,
34+
// it is cast as an IEnumerable<JProperty> which causes problems when trying to serialize the graph to send to the client
3335
propertyGraphType = propertyGraphType.Wrap(type, propertyType.Mandatory, false, propertyType.PropertyEditorAlias != global::Umbraco.Core.Constants.PropertyEditors.Aliases.Grid);
3436

3537
if (propertyType.VariesByCulture())
@@ -44,11 +46,8 @@ public PublishedPropertyFieldType(IPublishedContentType contentType, PropertyTyp
4446
Name = publishedPropertyType.Alias.ToCamelCase();
4547
Description = propertyType.Description;
4648
Resolver = new FuncFieldResolver<IPublishedElement, object>(context =>
47-
{
48-
var val = context.Source.Value(propertyType.Alias, context.GetArgument<string>("culture"),
49-
fallback: Fallback.ToLanguage);
50-
return val;
51-
});
49+
context.Source.Value(propertyType.Alias, context.GetArgument<string>("culture"),
50+
fallback: Fallback.ToLanguage));
5251
}
5352
}
5453
}

0 commit comments

Comments
 (0)