Hi, I am using graphql to access my Prismic Data from a gatsby application. I have to different custom types, both having a title field being defined by the following json
"title" : {
"type" : "StructuredText",
"config" : {
"single" : "heading1",
"label" : "Titel"
}
}
If I query them with GraphQL by
query SpeakersEnQuery {
allPrismicSpeakers(filter: {
lang: {eq: "en-gb"}
}) {
edges {
node {
data {
title {
text
}
}
}
}
}
allPrismicInformation(filter: {
lang: {eq: "en-gb"}
}) {
edges {
node {
data {
title {
text
}
}
}
}
}
}
I expect to get the same result. But in allPrismicInformation, the title is a object, containing text (so title.text works, in allPrismicSpeakers, title is an array containing only one object, which itself contains the text. So I need to include title[0].text.
{
"data": {
"allPrismicSpeakers": {
"edges": [
{
"node": {
"data": {
"title": [
{
"text": "Lorem"
}
]
}
}
}
]
},
"allPrismicInformation": {
"edges": [
{
"node": {
"data": {
"title": {
"text": "ipsum"
}
}
}
}
]
}
},
"extensions": {}
}
Does anyone have an idea why this is happening? I noticed this quite often but always thought I might have made a mistake. But this here is quite obvious. I also have a similar problem with links where in on Custom type I get the reference to the linked document and can access it directly and in another custom type using the exact same json definition for the link, I only get the uid of the linked document and need to query it for myself. I think I just overlook something.
Thanks