Hey - I just updated to latest gatsby and latest datocms-source, and now my content from datocms json fields is fetched in a wrong format (I suppose):
{
en: â{\nâ +
â âPARTIALSâ: {\nâ +
â âHEADERâ: {\nâ +
â âCARTâ: âCartâ,\nâ +
â âACCOUNTâ: âAccountâ,\nâ +
â âLOGOUTâ: âLog outâ\nâ +
â },\nâ +
â âFOOTERâ: {\nâ +
â âADDRESSâ: âAddressâ,\nâ +
â âCONTACTâ: âContactâ,\nâ +
â âFOLLOWâ: âFollow Usâ,\nâ +
â âLANGUAGEâ: âLanguageâ,\nâ +
â âCURRENCYâ: âCurrencyâ\nâ +
â }\nâ +
â },\nâ +
⌠etc
Hello @anders
sorry for that
Have you tried rolling back to the previous gatsby-source-datocms that was working? Can you please report on which version were you before the update?
No I didnât try to roll back - would like the latest version as I try to keep deps up to date once in a while The latest version that worked was version â2.3.0â as far as I can see.
sure, but maybe can you just try to roll back our source plugin to check if the problem is there or somewhere else?
It worked prior to upgrading and I did a yarn upgrade gatsby-source-datocms in order to get the latest, so the problem came after upgrading. And I have done a fresh install of node modules.
can you maybe share the access to your repo? feel free to reach out via PM (iâm matjack1 on github)
You should have access to a temp repo now
If I should try master, than itâs working fine here
Iâm with node v12.13.1
and you?
The solution is set to run v15.5.1. Did you update gatsby-source-datocms to the latest? I actually used 2.3.0 again since I needed it to work.
Try to remove it and install the latest version and see what happens.
letâs follow up on your repo, ok?
Hello, the problem is still there.
I am getting exactly the same Json.
Node version v18.12.1
âdependenciesâ: {
âbabel-plugin-styled-componentsâ: â^2.0.7â,
âgatsbyâ: â^5.7.0â,
âgatsby-plugin-anchor-linksâ: â^1.2.1â,
âgatsby-plugin-imageâ: â^3.7.0â,
âgatsby-plugin-manifestâ: â^5.8.0â,
âgatsby-plugin-sharpâ: â^5.7.0â,
âgatsby-plugin-sitemapâ: â^6.7.0â,
âgatsby-plugin-smoothscrollâ: â^1.2.0â,
âgatsby-plugin-styled-componentsâ: â^6.7.0â,
âgatsby-source-datocmsâ: â^5.0.4â,
âgatsby-source-filesystemâ: â^5.7.0â,
âgatsby-transformer-sharpâ: â^5.7.0â,
âprop-typesâ: â^15.8.1â,
âreactâ: â^18.2.0â,
âreact-domâ: â^18.2.0â,
âreact-helmetâ: â^6.1.0â,
âreact-iconsâ: â^4.8.0â,
âreact-scrollspyâ: â^3.4.3â,
âstyled-componentsâ: â^5.3.9â
}
This is what my json looks like if I make a request directly in the Dato CMS API Explorer:
query MyQuery {
homePage {
aboutList
}
}
=========
Gatsby
query MyQuery {
datoCmsHomePage {
aboutList
}
}
{
âdataâ: {
âdatoCmsHomePageâ: {
âaboutListâ: â{\n "aboutListLeft": [\n {\n "title": "Birthday:",\n "description": "15 Apr 1990"\n },\n {\n "title": "Phone:",\n "description": "+33 7 42 57 51 17"\n },\n {\n "title": "Study:",\n "description": "Institute of Photography"\n }\n ],\n "aboutListRight": [\n {\n "title": "Degree:",\n "description": "Master"\n },\n {\n "title": "Mail:",\n "description": "leotobias@gmail.com"\n },\n {\n "title": "Freelance:",\n "description": "Available"\n }\n ]\n}â
}
},
âextensionsâ: {}
}
hello @dan1work2mail can you please share access to some code where I can reproduce the issue? You can invite me (m.giaccone@datocms.com) to your repo if you want.
Hello,
I sent you an invitation (danmiles github name).
The original json file is located
to src/data folders
This is how it looks in Dato cms (everything works fine there)
But in Gatsby
query MyQuery {
datoCmsHomePage {
aboutImage {
gatsbyImageData(width: 400, height: 478)
alt
}
aboutTitle
aboutContent
aboutList
}
}
Response to a request:
"aboutList": "{\n \"aboutListLeft\": [\n {\n \"title\": \"Birthday:\",\n \"description\": \"15 Apr 1990\"\n },\n {\n \"title\": \"Phone:\",\n \"description\": \"+33 7 42 57 51 17\"\n },\n {\n \"title\": \"Study:\",\n \"description\": \"Institute of Photography\"\n }\n ],\n \"aboutListRight\": [\n {\n \"title\": \"Degree:\",\n \"description\": \"Master\"\n },\n {\n \"title\": \"Mail:\",\n \"description\": \"leotobias@gmail.com\"\n },\n {\n \"title\": \"Freelance:\",\n \"description\": \"Available\"\n }\n ]\n}"
}
},
Hey @dan1work2mail Iâve tried your repo but everything works well to me. Where are you doing the query from? If easier, feel free to continue the discussion on your repo, thatâs fine
This is the About.jsx component
I removed this feature now I will add it again.
datoCmsHomePage {
aboutList
})
============
What is very strange when I make a request on localhost in
localhost:8000/___graphql
THAT is what happens screenshot below
But when I call it in coponent About.jsx
const data = useStaticQuery(graphql`
query {
datoCmsHomePage {
aboutImage {
gatsbyImageData(width: 400, height: 478)
alt
}
aboutSubtitle
aboutTitle
aboutContent
aboutList
}
}
`);
console.log(data.datoCmsHomePage.aboutList);
It produces a normal result.
{
"aboutListLeft": [
{
"title": "Birthday:",
"description": "15 Apr 1990"
},
{
"title": "Phone:",
"description": "+33 7 42 57 51 17"
},
{
"title": "Study:",
"description": "Institute of Photography"
}
],
"aboutListRight": [
{
"title": "Degree:",
"description": "Master"
},
{
"title": "Mail:",
"description": "leotobias@gmail.com"
},
{
"title": "Freelance:",
"description": "Available"
}
]
}
uhm, are you on linux/mac/windows? which version?
Just to understand, is it good now then, or do you still need to figure things out?
Windows 10 Pro release
Version 22H2
OS Build 19045.2728
Interoperability Windows Feature Experience Pack 120.2212.4190.0
it doesnât work, I wrote it wrong, the console gives out not an array, but just a string
ok, itâs not critical, I just thought Iâd let you know about this problem.
uhm, ok, but if the code gets the data right, it looks like a visualization error, more than anything.
If this is the case, the problem is within Gatsby, nothing we can act on, sorry