Latest products not showing in app but show in GraphiQL

Solved

Latest products not showing in app but show in GraphiQL

yellowbrickcode
Shopify Partner
5 1 0

I've recently built a shop using Hydrogen and deployed it to Oxygen. All has been working great, but recently new products added have stopped showing on the page that displays all products. No changes were made to the code during the time it stopped working. On the 28th June, new products added showed up in the app. Products added from 29th onwards are not showing. If I run the same query in the GraphiQL explorer, I get the expected results with the new products included. The same query run via the Hydrogen app gets nothing added after the 28th. I've checked the following:

  • All new products are active and available for sale
  • No code changes were made in the window where products stopped appearing
  • No Shopify releases around this time seem like they should affect anything
  • No activity happened in the administration of the store around this time, other than the new products being added
  • I tried added CacheNone() to the Storefront query call form the app to ensure nothing was being cached

Does anyone have any ideas what might be causing this? It's such a weird issue, and I think I've exhausted all my debugging ideas. 

Accepted Solution (1)

yellowbrickcode
Shopify Partner
5 1 0

This is an accepted solution.

For anyone who may come across this in the future with a similar problem, I don't really have a solution as such. I eventually refactored all my code away from using the query param on products as that was definitely the problem. In my case I think I was better off using filters anyway so it wasn't such a bad thing.

 

It was a really strange issue. The queries were correct, the results were not. My best guess is something was being cached at API level but I couldn't say for sure. But eventually, with no changes to my query or code, it started working and returning the correct results.

View solution in original post

Replies 4 (4)

SBD_
Shopify Staff
1829 272 417

Hey @yellowbrickcode 

Are you able to provide store details and a link to the Hydrogen deployment? (DM if you'd prefer 🙂 )

Scott | Developer Advocate @ Shopify 

yellowbrickcode
Shopify Partner
5 1 0

I've made some progress with this today. The fact it works via GraphiQL and not via the app meant that it had to be code related if it wasn't anything deeper. So I went back through my code and it seems to be an issue with the query I'm applying. On the page that displays everything, if no filters were applied I was setting the query to `*`, which for some reason isn't returning anything added after the 28th June. I wasn't setting any filter in GraphiQL, and when I added one, I got the same results as the app. By sending `null` instead of `*` when no filters are set, I now get all the products when I load the shop 👌 I still have some issues with my filtering, as when I try and filter to all cards, I'm not getting anything after the 28th still, but I feel like I'm on track to figuring this out now 🤞 Off to take a deep dive into the query param! 

yellowbrickcode
Shopify Partner
5 1 0

After some more investigation, it seems to be an issue with using the `tag` filter param in the query. For example, all of the products added after the 28th are tagged with 'cards', but when I pass in the query `tag:cards`, I don't get any of the cards added after the 28th. Any ideas or tips appreciated! 

yellowbrickcode
Shopify Partner
5 1 0

This is an accepted solution.

For anyone who may come across this in the future with a similar problem, I don't really have a solution as such. I eventually refactored all my code away from using the query param on products as that was definitely the problem. In my case I think I was better off using filters anyway so it wasn't such a bad thing.

 

It was a really strange issue. The queries were correct, the results were not. My best guess is something was being cached at API level but I couldn't say for sure. But eventually, with no changes to my query or code, it started working and returning the correct results.