Skip to content

Why are nodes optional? #19

Description

@pcraciunoiu

I was trying to dig through this to figure it out, and I apologize if there's a good reason for this.

It seems to me that a paginated connection (e.g. DjangoConnectionField or DjangoFilterConnectionField) always has edges and nodes. What's the use case for these being nullable?

The reason I bring this up is because, when using TypeScript with the generated schema, it results in lengthy checks like this:

            {edges.map(edge => (
              <div>
                {edge &&
                  edge.node &&
                  edge.node.id (
                    ...<JSX here>

As far as I can tell this is set up here:
https://github.com/graphql-python/graphql-relay-py/blob/master/graphql_relay/connection/connection.py#L44

Could there be required on edges/nodes? At least as an option it'd be a breaking change. Right now I'm not sure how to override this.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions