Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WooGraphQL Pagination Repeating Results #896

Open
AliAUZ opened this issue Oct 12, 2024 · 0 comments
Open

WooGraphQL Pagination Repeating Results #896

AliAUZ opened this issue Oct 12, 2024 · 0 comments

Comments

@AliAUZ
Copy link

AliAUZ commented Oct 12, 2024

Description: When querying products using GraphQL with pagination (hasNextPage is true), subsequent requests using endCursor as the after variable return repeated results instead of unique products. Despite hasNextPage being true, the results loop over the same products, preventing successful data retrieval beyond the first set.

Reproduction Steps:

1- Run the GraphQL query for products with the first set to 100 (42 results returned by query).
2- Use endCursor from the response for the after variable.
3- Observe that results repeat.
Expected Behavior: Unique products should be fetched on each subsequent request until hasNextPage is false.

query GetProducts( $first: Int! $after: String $taxonomyFilter: ProductTaxonomyInput ) { products( first: $first after: $after where: { taxonomyFilter: $taxonomyFilter } ) { edges { node { ... on SimpleProduct { id databaseId name sku price stockStatus productCategories { nodes { id databaseId name } } attributes(where: { type: GLOBAL }) { nodes { attributeId options name } } galleryImages { nodes { id altText sourceUrl } } slug } } } pageInfo { hasNextPage hasPreviousPage startCursor endCursor } } }

and the input

{ "first": 100, "after": "xxxxxxxxxxxxx", "taxonomyFilter": { "relation": "AND", "filters": [ { "taxonomy": "PA_BRAND", "terms": ["Toyota"], "operator": "IN" }, { "taxonomy": "PA_MODEL", "terms": ["Camry"], "operator": "IN" }, { "taxonomy": "PA_PRODUCTION_YEAR", "terms": ["2015", "2016", "2017"], "operator": "IN" } ] } }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant