next.js – NextJS Site fetching different content in live version with GraphQL
I have developed a NextJS site with a headless CraftCMS backend and deployed through Vercel. (Since the site is live I have translated the items now for the time being but it’s still fetching from the wrong language)
I am fetching my content using Apollo and Graphql.
The problem is now that for whatever reason on the live site I get different content, specifically the menuItem’s language is wrong even though the rest of the query gets me the right language.
my query:
query MyQuery($language: [String]) {
globalSets(language: $language) {
... on footer_GlobalSet {
footerJobLinkLabel
footerSection1
footerSection2
footerSection3
footerSocials {
... on socialMediaChannel_Entry {
socialMediaUrl
icon {
url
width
height
}
}
}
}
... on general_GlobalSet {
reserveActive
languageSwitcherActive
reserveLabel
deliveryLabel
applyLabel
hoursLabel
kitchenLabel
allLocationsLabel
moreLabel
downloadText
menuItems {
... on menuItem_Entry {
id
label
pageRelation
inputLink
menuSubItems {
... on menuSubItem_Entry {
id
label
pageRelation
inputLink
}
}
}
}
firstNameLabel
lastNameLabel
mailLabel
numberLabel
notesLabel
sendLabel
uploadLabel
uploadInfo
jobLabel
}
}
}
And my Fetch:
const globalData = await apolloClient.query({
query: GLOBAL_QUERY(),
variables: {
language: locale.locale
}
});
Read more here: Source link


