I’m currently trying to fetch an entry by another entry that it’s linked from.
The following query works fine as long as locale
is the default locale or undefined.
As soon as it’s defined though, the query will still find the correct newsArticle
item by unlocalized slug
, but the linkedFrom.newsMainCollection.items
array will remain empty.
How is the linkedFrom
result dependent on localization? It doesn’t occur to me why it wouldn’t return any linkedFrom
entry when using a different locale than default.
export const NEWS_ARTICLE_BY_SLUG = gql`
query GetNewsMainBySlug($slug: String!, $preview: Boolean!, $locale: String) {
newsArticleCollection(
limit: 1
locale: $locale
preview: $preview
where: { slug: $slug }
) {
items {
linkedFrom {
newsMainCollection(limit: 1) {
items {
...NewsMainDetailsFields
}
}
}
}
}
}
${FRAGMENT_NEWS_MAIN_DETAILS}
`;