Skip to content

Commit

Permalink
Don't append __typename if it's already being selection (#1221)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nigel Sampson committed Dec 3, 2019
1 parent 4984a7f commit ae72f1a
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,12 @@ protected override SelectionSetNode RewriteSelectionSet(

RemoveDelegationFields(current, context, selections);
AddDependencies(context.TypeContext, selections, dependencies);
selections.Add(CreateField(WellKnownFieldNames.TypeName));

if (!selections.OfType<FieldNode>().Any(n => n.Name.Value == WellKnownFieldNames.TypeName))
{
selections.Add(CreateField(WellKnownFieldNames.TypeName));
}

current = current.WithSelections(selections);
current = base.RewriteSelectionSet(current, context);
current = OnRewriteSelectionSet(current, context);
Expand Down

0 comments on commit ae72f1a

Please sign in to comment.