Skip to content

Commit

Permalink
fix by getting underlying type prior to delegation (#1639)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
yaacovCR committed Jun 11, 2020
1 parent ab31a8f commit 438f706
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/stitch/src/stitchingInfo.ts
Expand Up @@ -6,6 +6,8 @@ import {
SelectionSetNode,
isObjectType,
isScalarType,
getNamedType,
GraphQLOutputType,
} from 'graphql';

import {
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 4 additions & 0 deletions packages/stitch/tests/typeMerging.test.ts
Expand Up @@ -16,6 +16,7 @@ let chirpSchema = makeExecutableSchema({
text: String
author: User
coAuthors: [User]
authorGroups: [[User]]
}
type User {
Expand Down Expand Up @@ -85,6 +86,9 @@ describe('merging using type merging', () => {
coAuthors {
email
}
authorGroups {
email
}
}
}
}
Expand Down

0 comments on commit 438f706

Please sign in to comment.