wp-graphql / wp-graphql

:rocket: GraphQL API for WordPress

Home Page:https://www.wpgraphql.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wrong field name

giafrata opened this issue · comments

Description

Doing a query to retrieve paginated comments in a single post, passing after parameter raise this error

"debugMessage": "Expected "value" value to be provided for WPGraphQL\Data\Cursor\CommentObjectCursor cursor compare field. A scalar value must be given.",

the problem is that you are checking for "by" variable but are using "value" here

if ( ! isset( $field['value'] ) ) {

query AllComments($postId: ID!, $after: String = "") {
  post(id: $postId, idType: DATABASE_ID) {
    id
    comments(where: {orderby: COMMENT_PARENT, order: ASC}, last: 1, after: $after) {
      pageInfo {
        endCursor
        hasNextPage
        hasPreviousPage
        startCursor
      }
      nodes {
        content(format: RENDERED)
        author {
          node {
            name
            email
          }
        }
        id
        databaseId
        date
        parentId
        dateGmt
        replies {
          nodes {
            content(format: RENDERED)
            author {
              node {
                name
                email
              }
            }
            id
            databaseId
            parentId
            date
            dateGmt
          }
        }
      }
    }
    commentCount
  }
}

Steps to reproduce

Try to paginate comments using after parameter.

Additional context

No response

WPGraphQL Version

1.22.0

WordPress Version

6.4.1

PHP Version

8.1

Additional environment details

No response

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have disabled ALL plugins except for WPGraphQL.

  • Yes
  • My issue is with compatibility with a specific WordPress plugin, and I have listed all my installed plugins (and version info) above.