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

V8: Repeatable textstring property grows with blank entries when open Rollback menu #8146

Closed
ReVoid opened this issue May 22, 2020 · 6 comments

Comments

@ReVoid
Copy link
Contributor

ReVoid commented May 22, 2020

Repeatable textstring datatype works not as expected when trying to navigate some other menus (detected a Rollback menu for now)

Umbraco version

Umbraco 8.6 (Pure Starter kit)

Reproduction

Bug summary

1

Steps to reproduce

  1. Add property editor of "Repeatable textstring" type to any document type.
  2. Focus the property UPD: or don't focus, it doesn't matter
  3. Open a sidebar menu, "Info > Rollback" in my case
  4. Return to the property, you will see it grown with a lot of empty entries

Expected result

Nothing changed with the property

Actual result

It has grown with lot of blank entries

@ReVoid ReVoid changed the title V8: Repeatable textstring property grows with blank entries when sidebar menu opens V8: Repeatable textstring property grows with blank entries when open Rollback menu May 22, 2020
@leekelleher
Copy link
Member

I was curious to see if this happens on my Contentment package (specifically the Content Blocks editor), and it does! 😨

Looking for similarities between my editor and Repeatable Textstring, it's looking to be that when the editor uses $scope.model.value as it's ng-model, the Rollback controller code will manipulate it directly.

When it first sets the vm.currentVersion object, it does so by reference, not by value (e.g. it doesn't take a copy).
https://github.com/umbraco/Umbraco-CMS/blob/release-8.6.1/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/rollback/rollback.controller.js#L27

Then in createDiff, the property values are manipulated in various ways - depending on the value's object type ... serialized/deserialized, etc.
https://github.com/umbraco/Umbraco-CMS/blob/release-8.6.1/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/rollback/rollback.controller.js#L122-L134

That the point where the Repeatable Textstring (and other editors that use $scope.model.value) will be manipulated.

I haven't dug any deeper for a resolution - time is against me today - but IMO it'd be either cloning the vm.currentVersion or the individual property.value objects? Hopefully this may help someone if they are looking to fix this bug.

@kjac
Copy link
Contributor

kjac commented May 25, 2020

Whoa not good. This also affects NC.

Great detective work, @leekelleher ... I'm on it.

@kjac
Copy link
Contributor

kjac commented May 25, 2020

PR in #8163

@leekelleher
Copy link
Member

Thanks @kjac! #h5yr 🚀

@PerplexDaniel
Copy link
Contributor

Good work @kjac & @leekelleher, just FYI this issue has been reported on earlier (July 2019 😱) in #5791 and another PR was submitted by @bjarnef which also copies the property. So good you both arrived at the same solution 😄 !

Would be awesome if one of these 2 PRs can be merged in soon. Any editor that stores their value as JSON is messed up by this. Hopefully someone from core can merge this soon (@nul800sebastiaan perhaps ❤️ ?)

@nul800sebastiaan
Copy link
Member

Thanks all, I've just closed the older issue #5791 merged the related PR, I'll close this as a duplicate! Fix is (finally) coming in 8.7.0.

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

Successfully merging a pull request may close this issue.

5 participants