I have a sidebar containing product categories and a grid of products. When the user selects a particular category, I need to load all of the products in that category.
In my Prismic repository, I have Category and Product types. Product contains a repeatable group of content relationships which link to one or more categories (i.e. 'Featured' and 'Travel'). These categories have a UID (i.e. 'featured') I am therefore trying to query based on this repeatable group as such:
Welcome to the Prismic community, and thanks for posting this question
This had me puzzled for a moment. Your query looks totally fine. But I think I see the issue. When you query by a Content Relationship, you need to pass the Document ID, not the UID.
For each result, you have some front matter that looks like this:
It looks like you're using the UID, and calling it ID, but each document already has a default ID property, which is a unique, random string. That is the property you need in order to query by Content Relationship.
Please let me know if that makes sense! And, in any case, let me know if you have more questions.
For now I've gone with the second method I mentioned which is working great (albeit perhaps not as efficient). I'll revisit your suggestion once I come to refactor it - I was definitely using the UID, so I'd imagine that switching to ID will indeed resolve the issue.