Replies: 3 comments 1 reply
-
We're facing a very similar challenge with our integration in Contentful. It sounds like you might be using For us, we fetch from Shopify first because Shopify is aware of our products and collections. Only after the product or collection is fetched, do we reach out to Contentful. We are trying to move away from this model and reach out to Contentful first by synchronizing Product and collection data in Contentful. Our goal is to Hope this helps! |
Beta Was this translation helpful? Give feedback.
-
@davidhousedev Thank you for reply! I have made it wait for sanity queue now, and then i fetch all the shopify hydrogen products/collections afterwards through useFetch. So im actually showing skeleton screen while sanity queue finishes (doesn't fit content 100%), and also afterwards when images from shopify is loading. |
Beta Was this translation helpful? Give feedback.
-
@davidhousedev Woow your a genius! Thank you a lot, a much better approach. However i am not 100% sure how this could be implemented in practice, can u provide a short code snippet how it could look? So i can see how it "could" look in the different files. Only the important details of course. I really appreciate it! 👍 One of the problems im facing is i use the components that render sanity modules (and require shopify data) multiple places in my application. Then all my routes will be filled with the same queries? Am referring to the famous principle DRY (don't repeat yourself). Can i somehow integrate (DRY, OOP) this with the solution you showed? (For example have a function that traverse data and get shopify data back), just not sure how this would look in practice tbh. |
Beta Was this translation helpful? Give feedback.
-
I am facing difficulty in determining the optimal approach to display skeleton screens in shopify hydrogen while loading Sanity modules.
The issue lies in the fact that without making an API call to the Sanity backend, I am unable to determine in advance the specific modules that have been chosen for use within Sanity. Consequently, I cannot display the correct grid template with skeletons when the module sequence changes from week to week due to sanity modifications. For example, this may include image or text modules, each of which may be loaded in a different order. It's hard to use Suspense Async Await when you don't know the stucture beforehand.
I am seeking guidance on the most effective method to enhance loading speed and show loading skeletons. One idea that has crossed my mind is to utilize Shopify Hydrogen to query Sanity periodically to establish the structure, allowing it to determine the placement of the skeletons before the user visits the site.
What, in your professional opinion, would be the most suitable method to tackle this problem?
Beta Was this translation helpful? Give feedback.
All reactions