From 438f7064e8257118f90c875f04471fdaf0ed71f5 Mon Sep 17 00:00:00 2001 From: Yaacov Rydzinski Date: Thu, 11 Jun 2020 11:41:24 -0400 Subject: [PATCH] fix by getting underlying type prior to delegation (#1639) This possibly should be added as an argument to the resolver for performance reasons. In general, the next version of type merging will require a lot of refactoring to improve performance. --- packages/stitch/src/stitchingInfo.ts | 3 +++ packages/stitch/tests/typeMerging.test.ts | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/packages/stitch/src/stitchingInfo.ts b/packages/stitch/src/stitchingInfo.ts index 50ad8352564..290b5d10522 100644 --- a/packages/stitch/src/stitchingInfo.ts +++ b/packages/stitch/src/stitchingInfo.ts @@ -6,6 +6,8 @@ import { SelectionSetNode, isObjectType, isScalarType, + getNamedType, + GraphQLOutputType, } from 'graphql'; import { @@ -106,6 +108,7 @@ function createMergedTypes( schema: subschema, operation: 'query', fieldName: mergedTypeConfig.fieldName, + returnType: getNamedType(info.returnType) as GraphQLOutputType, args: mergedTypeConfig.args(originalResult), selectionSet, context, diff --git a/packages/stitch/tests/typeMerging.test.ts b/packages/stitch/tests/typeMerging.test.ts index e72c09f3def..ad48ddc6b01 100644 --- a/packages/stitch/tests/typeMerging.test.ts +++ b/packages/stitch/tests/typeMerging.test.ts @@ -16,6 +16,7 @@ let chirpSchema = makeExecutableSchema({ text: String author: User coAuthors: [User] + authorGroups: [[User]] } type User { @@ -85,6 +86,9 @@ describe('merging using type merging', () => { coAuthors { email } + authorGroups { + email + } } } }