Nested BlockGrid and BlockEditorConverter
# help-with-umbraco
d
Hi. On an U12 project we've added a preview to our BlockGrids in the backoffice to give the editors an idea of how the frontend looks. Now that we've upgraded the solution to U13, some of this preview has broken. More particular, it seems to break when we have BlockGrid components inside a BlockGrid component. Like an Accordion with a number of AccordionItems. We're using the BlockEditorConverter.ConvertToElement(BlockItemData data, PropertyCacheLevel referenceCacheLevel, bool preview) to make the json from the backoffice into a IPublishedElement, and it seems like it fails somewhere in that conversion. It returns the Accordion component just fine, with all the properties correct, except the BlockGrid of AccordionItems, which ends up NULL. If we change the inner BlockGrid to a BlockList it works, but it would require a bigger rewrite of some of our code, so would prefer not to, if anyone has suggestions for workarounds.
m
Hey @Diriana, did you ever find a fix for this?
d
Hey @Mike Masey . No, we didn't find a fix for it. We ended up biting the bullet and made the inner grid into a blocklist.
m
Ah no worries 🙂
m
Wonder if serialisation via the contentdeliveryapi might have better results?
r
I had something similar to this on the BlockPreview package, where nested blocks weren't being displayed properly. I think it came down to a serialization/deserialization issue, which I had to do this for: https://github.com/rickbutterfield/Umbraco.Community.BlockPreview/blob/develop/src/Umbraco.Community.BlockPreview/Services/BackOfficePreviewServiceBase.cs#L56-L73
Effectively try and deserialize the nested data back to
BlockValue
once the JSON has hit the server