Skip to content

type lookup in hint fails #868

@timsuchanek

Description

@timsuchanek

Hi,

we're using the codemirror-graphql in the GraphQL Playground and experience problems, that the type property of a suggestion is undefined.
It happens in this line of code:
https://github.com/graphql/codemirror-graphql/blob/master/src/hint.js#L66

The problem is, that item.detail can contain ! in the case of a non-nullable type.
item.detail comes from here https://github.com/graphql/graphql-language-service/blob/master/packages/interface/src/getAutocompleteSuggestions.js#L97

schema.getType() however is just returning getTypeMap()[name] - as there is no type with the name User!, undefined is returned.
https://github.com/graphql/graphql-js/blob/master/src/type/schema.js#L182

Now is the question what the solution for this could be.
The quick-fix, that would work for us, is just not calling .getType() in hint anymore.
But I guess that the type lookup has been added for a reason.

@asiandrummer would be awesome to hear your take on that.

Thanks!

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions