Home App Docs Blog Github

References data in builder-component state

Hi, is it possible to have references data in builderState? i have custom field of type list of references.

I’d like to have references data from parent component of type Page

Hello, thanks for posting! Do you mind elaborating on what you’re looking to do? Maybe a code example?

Sure.
First of all this is a use case with page generation using Gatsby. :slight_smile:
I have a Page (let’s call it ParentPage) with a custom field of type List; this list contains References to some entries of any type (eg Page or some Data type). Then I have my imported React component which I’m adding to ParentPage; that component has builderState prop available; in this prop I have some ParentPage data; among others there are my defined custom fields, especially my list of References. BUT not deeply resolved. I have only reference Id, type and so. (when calling API i have an option includeRefs which gives all data, even what’s inside References, so eg blogPost title etc.)

I did a workaround, dynamically fetching references by given Id :slight_smile: :man_shrugging:

article(query:
{
id: “{’$in’: [list of ids]}”
}
)