You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
there are double quotes inside double quote fields (the html). You cannot parse this without making some wierd regex things to remove the generated html. I don't need the generated html but the whole repeater field is a type String in GraphQL so I cannot un-select it.
Lazy Blocks Version:
3.4.4
WordPress Version:
6.2.2
Any helpful information to reproduce the issue (screenshots, code parts)
The block:
The text was updated successfully, but these errors were encountered:
For everyone else having this issue, here is a JS/TS method to fix the fields (highly optionated though):
constparseFaultyJSON=<Item>({ faultyJSONString }: {faultyJSONString: string|undefined|null})=>{try{if(!faultyJSONString){thrownewError()}// The string is orignally URI encoded, so we need to decode it firstconsturiDecoded=decodeURI(faultyJSONString)// Now remove the `rendered` field because it contains invalid json.constcleaned=uriDecoded.replace(/"rendered"[\s\S]*?\\n"/g,'')// Because the is a `description` object that should be named `image` we need to rename it.constremovedDuplicateField=cleaned.replace(/"description":{/g,'"image":{')constremovedTailingCommas=removedDuplicateField.replace(/,}/g,'}')letjson=JSON.parse(removedTailingCommas)asItem[]returnjson}catch(error){console.error(error)returnnull}}
Unfortunately, I can't reproduce this issue. I have tested it on a fresh installation without 3rd-party plugins and a standard Twenty Twenty-Three theme.
Issue description:
I have created a block with a repeater field. When I query this with
WPGraphQL
(v1.14.9) andWPGraphQL Content Blocks
(v1.1.2) like this:GraphQL query
I do get the following response:
JSON response
The issue is that the repeater field is invalid JSON. If you url-decode it, it returns the following:
Issues
String
in GraphQL so I cannot un-select it.Lazy Blocks Version:
3.4.4
WordPress Version:
6.2.2
Any helpful information to reproduce the issue (screenshots, code parts)
The block:
The text was updated successfully, but these errors were encountered: