graphiql: type lookup in hint fails

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!

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 1
  • Comments: 15 (10 by maintainers)

Commits related to this issue

Most upvoted comments

unfortunately, i don’t know either. it’s a pain to disable Check JS every time, though 😦

also, thank you @yoshiakis so very much for your stewardship of codemirror-graphql!

@acao yeah, i think so 😃 (refactoring the test cases still remains, but the bug has been fixed so I think this issue can be closed.)

@acao yeah, it’s ok. and thank you for merging! I want to do other PRs for refactoring and adding test cases and changing code of hint.js a little bit because the way how the value of documentation in completion list is determined has been slightly changed by the merging, which didn’t consider #1541.

@acao would you please reopen this issue? Unfortunately, this issue hasn’t been fixed yet. I’m currently modifying the test code in a branch which needs to be merged to fix this issue.

@acao This issue is not solved yet. Sorry for stopping fixing this issue. Can I continue to be responsible to solve this issue? I think I can throw fixed PR in 1 or 2 weeks.