From 916289c9121b1046084f9fcad0c2a2952b9536d5 Mon Sep 17 00:00:00 2001 From: Gido Koning <60574784+ggkoning@users.noreply.github.com> Date: Tue, 19 Dec 2023 11:00:23 +0100 Subject: [PATCH] Fix/error when querying nested content items with list part (#14916) --- .../OrchardCore.Lists/GraphQL/ListQueryObjectType.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/OrchardCore.Modules/OrchardCore.Lists/GraphQL/ListQueryObjectType.cs b/src/OrchardCore.Modules/OrchardCore.Lists/GraphQL/ListQueryObjectType.cs index 6ac348e0ef6..72c33445cdf 100644 --- a/src/OrchardCore.Modules/OrchardCore.Lists/GraphQL/ListQueryObjectType.cs +++ b/src/OrchardCore.Modules/OrchardCore.Lists/GraphQL/ListQueryObjectType.cs @@ -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; @@ -28,7 +29,8 @@ public ListQueryObjectType(IStringLocalizer S) .Description("the content items") .Argument("first", "the first n elements (10 by default)", 10) .Argument("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();