Content Blocks: Handle JArray
data (typically when nested)
#391
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Handle the 'sometimes' when the stored ContentBlock data appears as a JArray instead of a string
In some circumstances
eg when a ContentmentBlocks is nested inside the Core Umbraco BlockList
(yes I know)
and it's moved between environments (uSync/Cloud) then the ContentBlock content although 'transferred' successfully doesn't get rendered by the ContentBlocksValueConverter because of the check to see if it is a string.
When Umbraco saves ContentBlocks within the BlockList JSON, then it escapes all the things \\\ and when it's ready in the ConvertSourceToIntermediate it is interpreted as a string as it's no longer valid JArray...
but when it's moved by a serialisation/deserialisation tool, then actually the stored value is a valid JArray and Umbraco returns the object to ConvertSourceToIntermediate as a JArray...
... which is why this PropertyValueConverter skips displaying it ...
(but it loads the content fine in the backoffice)
this pragmatic suggestion sort of caters for this quite niche scenario - but also I don't think does any harm to non-niche scenarios and is the place in the whole setup with the least moving parts, but also also, spiritually I recognise this probably isn't the internationally agreed place to fix this sort of thing...
Related Issues?
Here is a related conversation: Jumoo/uSync.Complete.Issues#226
Types of changes
Checklist