Skip to content

Pagination - previous products, last and before #928

Open
@Nico2d

Description

@Nico2d

Describe the bug
I am experiencing an issue with back pagination, after using last and before props with startCursor of the "nextPage" I can't go back to previous products.

To Reproduce
My query:

query AllProducts($filters: [ProductTaxonomyFilterInput], $minPrice: Float, $maxPrice: Float, $after: String, $first: Int, $last: Int, $before: String) {
  products(
    first: $first
    after: $after
    last: $last
    before: $before
    where: {minPrice: $minPrice, maxPrice: $maxPrice, taxonomyFilter: {filters: $filters} orderby: { field: NAME order: DESC}}
  ) {
    pageInfo {
      endCursor
      hasNextPage
      startCursor
      hasPreviousPage
    }
    nodes {
      databaseId
      name
      slug
    }
  }
}

Products on the 1 page:
Image

Products on the 2 page:
(using the endCursor tag on after property)
Image

Try to go back to 1 page:
(using the startCursor tag on before property and change using first to last)

Image
As you can see, there is different products then on page 1, and we didn't get hasPreviousPage: false

Expected behavior
After using before we should go back to previous page

Plugin Versions

  • WooGraphQL Version: - 0.21.2
  • WPGraphQL Version: - 1.29.3
  • WordPress Version: - 6.7.2.
  • WooCommerce Version: - 9.4.2

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