Dedicated to the Hydrogen framework, headless commerce, and building custom storefronts using the Storefront API.
Hi!
Struggling with queries. To my understanding, a query is directly correlated to the URL path, and that you cannot access some data points unless the loader's parameters are fed in from $handle. Here's an example query:
query FeaturedCollections { collection(handle: "bolts") { products (first: 2) { nodes { id title handle media(first: 1) { nodes { ... on Model3d { id mediaContentType sources { mimeType url } } } } } } } }
In the local graphiql instance, this query successfully returns the product data I need. But, on the frontend, the GetLoaderData() request returns undefined. My guess is because of the URL path "/", and the fact that I'm hardcoding the handle into the query.
What I need is to be on the root of my app, make a query for the products in collection "bolts", grab the gltf-binary URL stored on the product, and actively load this into the root using a Model3D component. But it seems I can't access this unless I am visiting the product in my URL Path (ex: instead of the root, it is /bolts/[product]). I was thinking I could workaround by making a query to the [collections -> products -> model] on index.jsx. Any help to get this implemented would be greatly appreciated!