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

Add a paginated version of Product.variants #1110

Closed
michaelbromley opened this issue Sep 23, 2021 · 0 comments
Closed

Add a paginated version of Product.variants #1110

michaelbromley opened this issue Sep 23, 2021 · 0 comments

Comments

@michaelbromley
Copy link
Member

Is your feature request related to a problem? Please describe.
In the GraphQL API, the Product.variants field returns an array of all variants.

If a product has more than 100 variants this causes 2 issues:

  1. You run into the apiOptions.shopListQueryLimit of 100, since behind the scenes the resolver makes use of the ListQueryBuilder (source). This means you then need to raise the limit in order to fetch all items in the storefront, or create a custom query to do so.
  2. In the Admin UI, loading the product detail view becomes slow. Having to join and send all the required related data for a product with ~300 variants took multiple seconds in my testing, where it is usually near-instant.

Describe the solution you'd like
Expose a new field on the Product type which implements the PaginatedList interface, allowing you to specify take, skip and even the usual sort and filter params.

We want this to be backwards-compatible, so we cannot just replace the existing variants field. We'll have to name it something else, such as variantsList. Not ideal since it breaks the naming convention, but we can fully replace the variants field in v2.0 and then deprecate variantsList.

The Admin UI will also be updated to use this new field and do proper server-side pagination rather than the purely client-side solution that was introduced in #411.

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

No branches or pull requests

1 participant