Product carousel

I'm new to Prismic.

I'me creating a website that is managed by Prismic and uses Nuxt 3.

Everything works fine. I can create Page-type, custom types and work with slices.

What i'm trying to do is a simple "Carousel" component thats shows some Products/Links (defined as custom types)
The carousel is made with some repeatable fields.

The problem that i'm facing is that when i loop the "repetable part".
this is how i implemented it in my "home" page-type

but when i try to render the component, in the "items" part, i cannot find any data about the image, the link or something else related to the type.

this is the json that is rendered in the Component.

what am I missing or making wrong?
Please help!

Hello @g.vallarelli,

Welcome to Prismic community, and thanks for reaching out to us!

I apologize for just getting to this.

I suspect this is happening because the image is coming from another document. You can use GraphQuery if you want to get content from another document, or an easier solution would be to add the image directly to the carrousel. Here's our docs on GraphQuery: GraphQuery - Documentation - Prismic.

In my experience of implementing a carousel, I would do it with a Slice with an Image and a key text field.


Hy racheal,
thank you for your answer.

i'm very sad about that. it will be more useful to already have the whole document if has some dependancy in it.

i'll try with GraphQuery.
Do i need to loop all the requests for all the linked documents? like, fetching GQL for every "card" inside my carousel, or there is a way to fetch all the linked document, passing the ID (or something else)?

Thank you in advance.

Hey @g.vallarelli,

You’ll need to specify exactly what you want from the document through the content relationship. This means you’ll only be able to get content from one document type and always the same content.

GraphQuery is the best way to fetch the data; you'll also have to use content relationships.
We have to use GraphQuery to specify what we want because returning all linked documents by default could potentially cause performance issues for the API.

The only other option is to query all the documents you need on your homepage in a separate query.