Open rangler2 opened 3 years ago
Hi,
I fixed it by adding the following to the start of the method to trick it into using the context of the homepage -
UmbracoContext.Current.PublishedContentRequest = new PublishedContentRequest(new Uri("https://mysite.localhost/"), UmbracoContext.Current.RoutingContext);
UmbracoContext.Current.PublishedContentRequest.Prepare();
Cheers Andy
Actually it sometimes reverted back to null by having it before the foreach loop so I had to move it into the loop and change it so it only does this when a macro is found otherwise it makes the request take way longer (over a minute) just from repeatedly setting the context.
Hi,
Just raising this on the off chance that someone has already fixed this... Am running a customised version of the Umbraco 7 version of GraphQL based upon the 0.1.0 version found on nuget which I think was from the master branch..
If I add a simple macro (with no parameters, using a .cshtml that just outputs some text) into a rich text editor and then try to retrieve this via GraphQL then the value is null and following error is included in the response:
If I attach the debugger then it throws on this line because it can't get the Value -
https://github.com/umbraco-community/umbraco-graphql/blob/65dcaabca2573807a2d397106b6ded39f662ac9b/src/Our.Umbraco.GraphQL/Types/ComplexGraphTypeOfIPublishedContentExtensions.cs#L176
The exception is -
I am now trying to work out how to artificially add an Umbraco Context into this class but raising in case someone has solved this previously , and if not I can update if/when I figure it out.....
Thanks, Andy