From 2a989c75b7203cb30576fb2ed2076ff6014edf7e Mon Sep 17 00:00:00 2001 From: ggkoning Date: Mon, 18 Dec 2023 16:19:58 +0100 Subject: [PATCH 1/2] Changed RevolveAsync on Field in ListQueryObjectType to ResolvedLockedAsync --- .../OrchardCore.Lists/GraphQL/ListQueryObjectType.cs | 3 ++- 1 file changed, 2 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..d152c7056e3 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,7 @@ 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 => + .ResolveLockedAsync(async g => { var serviceProvider = g.RequestServices; var session = serviceProvider.GetService(); From 1665cd33b1e8325ea3550b560264a40c3c04114f Mon Sep 17 00:00:00 2001 From: ggkoning Date: Mon, 18 Dec 2023 16:36:29 +0100 Subject: [PATCH 2/2] Add comment --- .../OrchardCore.Lists/GraphQL/ListQueryObjectType.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/OrchardCore.Modules/OrchardCore.Lists/GraphQL/ListQueryObjectType.cs b/src/OrchardCore.Modules/OrchardCore.Lists/GraphQL/ListQueryObjectType.cs index d152c7056e3..72c33445cdf 100644 --- a/src/OrchardCore.Modules/OrchardCore.Lists/GraphQL/ListQueryObjectType.cs +++ b/src/OrchardCore.Modules/OrchardCore.Lists/GraphQL/ListQueryObjectType.cs @@ -29,6 +29,7 @@ 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) + // 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;