Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serialized data (eg. Multi Url picker) in block data gets deserialized #538

Closed
skttl opened this issue Sep 5, 2023 · 4 comments
Closed

Comments

@skttl
Copy link

skttl commented Sep 5, 2023

Describe the bug
I am currently doing a migration of a v8 site into v12, converting grid to block grid. It's a Cloud site, so I need Deploy to understand the values afterwards.

When having JSON based editors (eg. Multi Url Picker) in your block data, the value gets saved into the usync file serialized (this is also what Umbraco backoffice does in the db). But when importing from a usync file, the serialized data gets deserialized, so the json is saved in the database.

Eg. how it looks in the usync file:
image

And how it looks in the database (umbracoPropertyData) after importing (I've formatted it in the texteditor, so the json is readable)
image

It's no problem for Umbraco, for some reason it can handle the value being both a serialized string of JSON, and a real JSON object.

But Umbraco Deploy expects it to be serialized - if not, it just transfers an empty value.

To Reproduce

  • Create a block list, with an element containing a Multi url picker.
  • Create a page with the block list, and add some content to the multi url picker.
  • Verify that umbracoPropertyData contains the value as a serialized string
  • Verify that the usync file generated by uSync contains the value as a serialized string
  • Import the content using the uSync dashboard
  • Verify that umbracoPropertyData now contains the value as a JSON object.

Expected behavior
The value should be saved as is. When the usync file contains a serialized string, the resulting umbracoPropertyData value should also contain a serialized string.

About your Site (please complete the following information):

  • Umbraco Version: 12.1.1
  • uSync Version: 12.1.0
  • Browser: Edge

Additional context
The site and backoffice works as expected despite the wrongly formatted value. But Umbraco Deploy doesn't.

@skttl
Copy link
Author

skttl commented Sep 5, 2023

Did some more investigating, and found #400

Tried rolling my own BlockListMapper, where the changes made to mitigate that issue (382e96e) was rolled back (so basically changing BlockListMapper from SyncNestedJsonValueMapperBase to SyncNestedValueMapperBase - and that fixed it!

Maybe block based editors are different from Nested Content in that regard?

@KevinJump
Copy link
Owner

This is one of my worlds of pains 😢 - what does and doesn't like the nested JSON serialized into a string or left like an object changes in the wind. There are cases were doing it one way means it works in the front end and not the back office! and its only for certain properties and it depends on what that are in .

i think block grid is a little more consistent than NestedContent but we use to have things store differently if they are nested inside something inside the grid, then when they are nested inside something outside the grid, or just in the grid 🤯 )

I will take a deep look, but the amount of times we have swapped out , serialize this as a string with Serialize this and an object on the nested values inside blocks etc, is making my head spin,

@KevinJump
Copy link
Owner

Hi,

did a little bit of tweaking, and i think i've found a happy place, where the uSync files are all nice and JSON object'y, but the values that get squeezed back into Umbraco are all escaped and \\\\\'y

We do have a nightly build for this PR if you want to test :

https://dev.azure.com/jumoo/Public/_artifacts/feed/nightly/NuGet/uSync/overview/12.2.0-build.20230905.2

It might be considered a 'format breaking' change this if it changes how the files are actually streamed out of Umbraco (and it might a tiny bit. Its not a big deal but we try not to break the format on patch releases, means this might have to be a minor release thing .

@skttl
Copy link
Author

skttl commented Sep 7, 2023

It fixes my problem 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants