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

Undo appears to be breaking Fred #137

Open
matdave opened this issue Oct 23, 2024 · 2 comments
Open

Undo appears to be breaking Fred #137

matdave opened this issue Oct 23, 2024 · 2 comments

Comments

@matdave
Copy link

matdave commented Oct 23, 2024

It appears that VersionX is storing the Resource properties data in a strange way. When clicking the "undo" it is modifying the Fred object into a way where Fred can no longer read it.

e.g. Before undo:

"fred":{"data":{"content":[{"widget":"93a11a9c-de0b-42fb-a2ad-9d4ca47f3a1b","values":[],"pluginsData":[],"settings":[],"children":[],"elId":"fred_e6bce7c_6oermhdfaxh"},{"widget":"88fe082e-8270-4a30-9f38-9634ce0cbff9","values":{"test":{"_raw":{"_value":"This is a test<br>"}},"text":{"_raw":{"_value":"<p><a href=\"\/blog\/\" data-fred-link-type=\"page\" data-fred-link-page=\"2\">Test tiny mce test<\/a><\/p>\n<p><img src=\"\/assets\/fred\/modx.png\" alt=\"modx.png\"><\/p>"}}},"pluginsData":[],"settings":{"test":""},"children":[],"elId":"fred_0f00a08_sx8xepm5hgk"}],"fingerprint":"ced09ab03db6eab390a937ddb29703e393c0491c"},"plugins":[]}

After undo:

"fred":{"data":{"content":":{0:{widget:93a11a9c-de0b-42fb-a2ad-9d4ca47f3a1b,values:{},pluginsData:{},settings:{},children:{},elId:fred_e6bce7c_6oermhdfaxh},1:{widget:88fe082e-8270-4a30-9f38-9634ce0cbff9,values:{test:{_raw:{_value:This is a test<br>}},text:{_raw:{_value:<p><a href=\"\/blog\/\" data-fred-link-type=\"page\" data-fred-link-page=\"2\">Test tiny mce test<\/a><\/p>\n<p><img src=\"\/assets\/fred\/modx.png\" alt=\"modx.png\"><\/p>}}},pluginsData:{},settings:{},children:{},elId:fred_0f00a08_sx8xepm5hgk}}","fingerprint":"e6bcb6087c9d9a4f384baee7ed034f2e71c1905c"}

Notice how it converts the "content" to a giant string.

@matdave
Copy link
Author

matdave commented Oct 23, 2024

For context, the "Revert all changes" seems to work fine. It is just the "undo" button that breaks things.

@muzzwood
Copy link
Contributor

Thanks @matdave. It looks like something's going awry when the array is being flattened during delta creation.
IIRC that utility was kept from the old version. I wonder if we can't just straight up use json_encode()...

The only downside I can think of off the top of my head is there might be some data in properties that is intended to be kept as json and others that isn't (when decoding). I'll investigate...

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