From 3c2970ef619a0eadb16487acb2b27b371e3ef6eb Mon Sep 17 00:00:00 2001 From: Michael Staib Date: Thu, 9 Jul 2026 22:34:20 +0200 Subject: [PATCH] [Fusion] Avoid a duplicate selection row read when initializing composite objects --- .../Execution/Results/ValueCompletion.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Results/ValueCompletion.cs b/src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Results/ValueCompletion.cs index 4776538ba34..7ae5419f999 100644 --- a/src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Results/ValueCompletion.cs +++ b/src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Results/ValueCompletion.cs @@ -391,6 +391,17 @@ private static bool TryGetSelectionContext( [NotNullWhen(true)] out Selection? selection, [NotNullWhen(true)] out IType? type) { + // Fast path: a direct-field target carries its own selection on the + // preceding property row. Reading that selection once lets us derive + // the type from it, avoiding a second metadb read via the Type getter. + selection = target.Selection; + + if (selection is not null) + { + type = selection.Type; + return true; + } + type = target.Type; if (type is null)