Skip to content

Commit

Permalink
Fix/error when querying nested content items with list part (#14916)
Browse files Browse the repository at this point in the history
  • Loading branch information
ggkoning authored Dec 19, 2023
1 parent 4f5d597 commit 916289c
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 916289c

Please sign in to comment.