graphql / graphql-relay-js

A library to help construct a graphql-js server supporting react-relay.
MIT License
1.54k stars 181 forks source link

undefinedConnection name for a connection definition #151

Closed excitement-engineer closed 3 years ago

excitement-engineer commented 7 years ago

In my code I have created a connection as follows:

const { connectionType: JokeItemConnection } = connectionDefinitions({
  nodeType: new GraphQLNonNull(GraphQLJoke)
});

export default new GraphQLObjectType({
  name: "User",
  description: "Represents a user of the joke API.",
  fields: () => ({
    //... other fields have been omitted
    jokes: {
      type: new GraphQLNonNull(JokeItemConnection),
      description: "All the user's jokes.",
      args: connectionArgs,
      resolve: (user: User, args, { viewer, loaders }: Context) =>
        connectionFromPromisedArray(
          user.jokes(loaders.joke),
          args
        )
    }
  })
});

Next, when I look in graphiql I see that the name of the connection is undefinedConnection:

screen shot 2017-02-25 at 14 52 05

When I now change the connection definition as follows:

const { connectionType: JokeItemConnection } = connectionDefinitions({
  nodeType: GraphQLJoke
});

Then the name of the connection is correct!

Is this a bug?

sibelius commented 7 years ago

@excitement-engineer is this still a problem for you?

excitement-engineer commented 7 years ago

Hey @sibelius! Thanks for reminding me:) I created a PR that fixes this issue, see #177.

IvanGoncharov commented 3 years ago

fixed in #331