Skip to content

Commit

Permalink
Fix/error when querying nested content items with list part (OrchardC…
Browse files Browse the repository at this point in the history
  • Loading branch information
ggkoning authored and urbanit committed Mar 18, 2024
1 parent 5242728 commit 14b809b
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using GraphQL.Types;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Localization;
using OrchardCore.Apis.GraphQL;
using OrchardCore.ContentManagement;
using OrchardCore.ContentManagement.GraphQL.Queries.Types;
using OrchardCore.ContentManagement.Records;
Expand All @@ -28,7 +29,8 @@ public ListQueryObjectType(IStringLocalizer<ListQueryObjectType> S)
.Description("the content items")
.Argument<IntGraphType, int>("first", "the first n elements (10 by default)", 10)
.Argument<IntGraphType, int>("skip", "the number of elements to skip", 0)
.ResolveAsync(async g =>
// Important to use ResolveLockedAsync to prevent concurrency error on database query, when using nested content items with List part
.ResolveLockedAsync(async g =>
{
var serviceProvider = g.RequestServices;
var session = serviceProvider.GetService<ISession>();
Expand Down

0 comments on commit 14b809b

Please sign in to comment.