Mayank1791989 / gql

112 stars 19 forks source link

Unknown Fragment in Apollo Projects #145

Open kumarharsh opened 6 years ago

kumarharsh commented 6 years ago

This issue is while working on the v3 branch.

When we import fragments in an apollo project, the plugin starts showing errors when the #imported fragments are used in a query. See https://github.com/Mayank1791989/gql-examples/blob/e372928662f66660bdcb8886400d3d8b5f37d429/apollo/src/graphql/Comment.graphql

#import "./CommentsPageComment.graphql"
query Comment($repoName: String!) {
  entry(repoFullName: $repoName) {
    id
    comments {
      ...CommentsPageComment  <-- error (KnownFragmentNames)
    }
  }
}

A related error is that the fragments which are imported keep showing a NoUnusedFragments error. (See https://github.com/Mayank1791989/gql-examples/blob/master/apollo/src/graphql/CommentsPageComment.graphql)

This issue is also there in non-apollo projects. See https://github.com/Mayank1791989/gql-examples/blob/e372928662f66660bdcb8886400d3d8b5f37d429/relay-modern-migrate-from-classic/src/components/Todo.js#L135