You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there official documentation for pagination? I have read in #221 and #369 that total count is not available, but it took me quite a while to realize that fetchAllProducts doesn't actually fetch all products, just the first 20 and the rest are paginated. There is a lot of discussion about fetching in #148 but I'm not sure if that is current with 1.0alpha.
Are all sets paginated?
Is it the same number per page for all sets (20)?
Is this the correct way to page through a set?
varproducts=awaitshopify.fetchAllProducts()// products contains up to 20 productsvarmoreProducts=awaitclient.graphQLClient.fetchNextPage(products)// moreProducts.model contains next page of up to 20 products starting at #21
Pagination added in #300 and #314 gave me the first clue, but there is no pagination in the shopify-buy library (P.S. developing and publishing on alpha branch and not master makes it difficult to search the code without downloading the whole library source).
So I inspected the products and the product items are actually a GraphModel. Googling for GraphModel gives me an empty doc but on the GraphModel objects are a function nextPageQueryAndPath. Google only shows a single result for nextPageQueryAndPath, the source to the GraphQL client, where luckily I found fetchNextPage. fetchNextPage seems to work fine.
Thanks!
The text was updated successfully, but these errors were encountered:
GraphModel is empty by design. It's extendable, but it's mostly an object proxy. v1 of Shopify Buy is really just a thin layer on top of our graphql client, and our storefront API. Pagination, at the API level, uses the relay connection specification, which is wrapped up nicely by graphql-js-client using fetchNextPage (part way down the page). There's also an example here. We absolutely need a better way to expose pagination at the top level of this library, but until then, your approach is correct.
Hello,
Is there official documentation for pagination? I have read in #221 and #369 that total count is not available, but it took me quite a while to realize that
fetchAllProducts
doesn't actually fetch all products, just the first 20 and the rest are paginated. There is a lot of discussion about fetching in #148 but I'm not sure if that is current with 1.0alpha.Pagination added in #300 and #314 gave me the first clue, but there is no pagination in the shopify-buy library (P.S. developing and publishing on alpha branch and not master makes it difficult to search the code without downloading the whole library source).
So I inspected the products and the product items are actually a GraphModel. Googling for GraphModel gives me an empty doc but on the GraphModel objects are a function
nextPageQueryAndPath
. Google only shows a single result fornextPageQueryAndPath
, the source to the GraphQL client, where luckily I foundfetchNextPage
.fetchNextPage
seems to work fine.Thanks!
The text was updated successfully, but these errors were encountered: