Skip to content

GraphQL Argument of 6 in posts(first: 6) causes no post edges to be returned #82

Description

@onceknown

When running this query in the gql playground:

  query GetSeriesList($host: String!, $first: Int!) {
    publication(host: $host) {
      seriesList(first: $first) {
        edges {
          node {
            id
            name
            slug
            description {
              html
            }
            posts(first: 6) {
              edges {
                node {
                  id
                  title
                  brief
                  slug
                  publishedAt
                  coverImage {
                    url
                  }
                  author {
                    name
                    profilePicture
                  }
                }
              }
            }
          }
        }
      }
    }
  }

I get the following returned, even though there is one post in the single series in my hashnode blog:

{
  "data": {
    "publication": {
      "seriesList": {
        "edges": [
          {
            "node": {
              "id": "...",
              "name": "...",
              "slug": "...",
              "description": {
                "html": "..."
              },
              "posts": {
                "edges": []
              }
            }
          }
        ]
      }
    }
  }
}

All I need to do is choose any integer that isn't 6 to get the API to return the expected post edges:

  query GetSeriesList($host: String!, $first: Int!) {
    publication(host: $host) {
      seriesList(first: $first) {
        edges {
          node {
            id
            name
            slug
            description {
              html
            }
            posts(first: 20) {
              edges {
                node {
                  id
                  title
                  brief
                  slug
                  publishedAt
                  coverImage {
                    url
                  }
                  author {
                    name
                    profilePicture
                  }
                }
              }
            }
          }
        }
      }
    }
  }

returns:

{
  "data": {
    "publication": {
      "seriesList": {
        "edges": [
          {
            "node": {
              "id": "...",
              "name": "...",
              "slug": "...",
              "description": {
                "html": "..."
              },
              "posts": {
                "edges": [
                  {
                    "node": {
                       ...                      
                    }
                  }
                ]
              }
            }
          }
        ]
      }
    }
  }
}

Hopefully this behavior is easy to map against the resolver logic.

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