Describe the bug
I queried a single collection with 12 products inside (pretty acceptable number of items) and the response took 4 secs in average. I tried multiple times and it's always between 3.85s and 5s.

To Reproduce
Do a query to a collection with 12 products with a shopify lite plan on client side.
Please include code samples.
const client = ShopifyBuy.buildClient({
domain: 'xxx',
storefrontAccessToken: 'xxx'
});
const collectionId = 'xxx';
client.collection.fetchWithProducts(collectionId).then((collection) => {
// Do something with the collection
console.log(collection);
console.log(collection.products);
});
x-request-id: 1e1bb72d-d9f3-4386-9408-a1341a585a7b
https://gist.github.com/darkylmnx/dd99662432500ff0491683267e4e14df
Expected behavior
I'm expecting the query to be fast (below 1s) as this is why I took shopify : the infrastructure.
This example is just for a collection page, the home page would have at least four collections queried in parallel so this time of response is not viable for my website.
Environment (please complete the following information):
Additional context
Was done on client side from an shopify.html page.
Bug Report Checklist
Seconded... these queries are taking forever... A workaround for me has been to cache the collections, but this is inconvenient. 18 days and no response? Really?
I've experienced the same thing when querying 20+ products at a time.
I've experienced the same thing when querying 20+ products at a time.
the worst thing is, I even tried on only 10 items and it was the same... So slow, I wonder why, I'm considering doing this at runtime with a JAMstack architecture to save the query but this is still annoying.
I've basically implemented the same workaround. I cache the JSON payload in the database and fetch that instead. Definitely not ideal as I've had to build an entire caching interface now.
If someone from Shopify has time, would you mind providing some details as to why these requests take so long?
I tried multiple times and it's always between 3.85s and 5s.
Thanks for flagging this. Subsequent requests to the same collection should now be faster.
I queried a single collection with 12 products inside (pretty acceptable number of items) and the response took 4 secs in average.
We are always looking for ways to improve the performance. One thing you could change on your side is write a custom query to only fetch the information that you need - instead of fetching all the information returned by client.collection.fetchWithProducts.
What do you mean by "only fetch the information you need"? Because I didn't
see any wya of filtering the fields".
As mentioned in the README, you can build custom queries: https://github.com/Shopify/js-buy-sdk#expanding-the-sdk
@darkylmnx Have you been able to work around your performance issues by writing custom queries? If so, I'd like to close this ticket out.
Most helpful comment
I've experienced the same thing when querying 20+ products at a time.