Skip to content

Commit

Permalink
Added createTypeName to ensure unique name for union types.
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Hellein <themichaek@gmail.com>
  • Loading branch information
michaek committed Apr 10, 2018
1 parent d169097 commit bd9240a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/gatsby/src/schema/infer-graphql-type.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,10 +248,10 @@ function inferFromFieldName(value, selector, types): GraphQLFieldConfig<*, *> {
// If there's more than one type, we'll create a union type.
if (fields.length > 1) {
type = new GraphQLUnionType({
name: `Union_${key}_${fields
name: createTypeName(`Union_${key}_${fields
.map(f => f.name)
.sort()
.join(`__`)}`,
.join(`__`)}`),
description: `Union interface for the field "${key}" for types [${fields
.map(f => f.name)
.sort()
Expand Down

0 comments on commit bd9240a

Please sign in to comment.