Closed jsommr closed 5 years ago
Enabling language invariants seems to help. So changing https://github.com/rasmusjp/umbraco-graphql/blob/09ea3aafc4d738a820f3c8d2b57501391cd924bd/src/Our.Umbraco.GraphQL/Types/PublishedPropertyFieldType.cs#L29-L34 to
Resolver = new FuncFieldResolver<IPublishedContent, object>(context =>
{
var userContext = (UmbracoGraphQLContext)context.UserContext;
IPublishedProperty publishedProperty = context.Source.GetProperty(publishedPropertyType.Alias);
object value = null;
var variations = publishedPropertyType.Variations;
if (variations == ContentVariation.Nothing)
value = publishedProperty.GetValue();
else if (variations == ContentVariation.Culture)
value = publishedProperty.GetValue(userContext.Culture);
else if (variations == ContentVariation.Segment)
value = "ContentVariation.Segment: TODO";
else if (variations == ContentVariation.CultureAndSegment)
value = "ContentVariation.CultureAndSegment: TODO";
return foundResolver.Resolve(context.Source, publishedPropertyType, value);
});
should in theory work, but my setup is pretty broken after getting a manually compiled Umbraco up and running. I'm getting some slightly better results, but will have to create a fresh Umbraco install and investigate further.
Not sure if this is still relevant since I'v rewritten most of the code.
Feel free to reopen if you still have problems with the code in the develop
branch
On the demo site, when executing
this is returned
I expected pageTitle to not be an empty string, because Umbraco shows that the fields have data in the UI. This is a fresh Umbraco installation with the demo website installed.
I traced the issue to https://github.com/rasmusjp/umbraco-graphql/blob/09ea3aafc4d738a820f3c8d2b57501391cd924bd/src/Our.Umbraco.GraphQL/Types/PublishedPropertyFieldType.cs#L29-L34 where
publishedProperty.GetValue(userContext.Culture)
returns "" for pageTitle because culture is passed as argument. Removing it returns the correct value, but we've lost localization support. userContext.Culture = "en-US".I'm in no way an expert in Umbraco, but the problem seems to be in
Umbraco.Web.PublishedCache.NuCache.Property
where (my comments in / /)It might be an Umbraco bug, or me doing something wrong, but filing it here because I'm clueless and just experimenting with your GraphQL api.