Skip to content

Commit 1d3055a

Browse files
authored
[Fusion] Avoid a duplicate selection row read when initializing composite objects (#10078)
1 parent c95b309 commit 1d3055a

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Results/ValueCompletion.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,17 @@ private static bool TryGetSelectionContext(
391391
[NotNullWhen(true)] out Selection? selection,
392392
[NotNullWhen(true)] out IType? type)
393393
{
394+
// Fast path: a direct-field target carries its own selection on the
395+
// preceding property row. Reading that selection once lets us derive
396+
// the type from it, avoiding a second metadb read via the Type getter.
397+
selection = target.Selection;
398+
399+
if (selection is not null)
400+
{
401+
type = selection.Type;
402+
return true;
403+
}
404+
394405
type = target.Type;
395406

396407
if (type is null)

0 commit comments

Comments
 (0)