Fix merging fields with arguments

executeField shouldn't assume that a selection has only one field with a
given name, but it should take the first field. The underlying cause is
a wrong pattern, which (because of the laziness) is executed only if the
field has arguments.
This commit is contained in:
2021-06-18 06:51:14 +02:00
parent 2ce2be5d91
commit 6fe9eb72e4
3 changed files with 10 additions and 2 deletions

View File

@ -97,7 +97,7 @@ executeField fieldResolver prev fields
where
executeField' fieldDefinition resolver = do
let Out.Field _ fieldType argumentDefinitions = fieldDefinition
let (Transform.Field _ _ arguments' _ _ :| []) = fields
let Transform.Field _ _ arguments' _ _ = NonEmpty.head fields
case coerceArgumentValues argumentDefinitions arguments' of
Nothing -> addError null $ Error "Argument coercing failed." [] []
Just argumentValues -> do