NC keys: When copying page nested content does not update properly
See original GitHub issueThis issue description has been updated with a propsed solution and has been marked as up for grabs. Please read below about the original issue and the proposed solution. You can also scroll way down to read the entire discussion and history.
Proposed solution
Taking some inspiration from the media tracking branch and looking at what we already have in core:
- Nested content (and any other property editor) can handle the
IDataValueEditor.FromEditor
to re-populate any missing keys. Nested content already overrides this method so it would be just adding the logic to check for empty keys. Empty keys may be sent up if the client side clears them when copying them with the clipboard service. Nested content calls FromEditor recursively so if there’s an NC inside an NC this will still work. - Create a new interface:
IDataValueCopying
which can be implemented by anyIDataValueEditor
(like likeIDataValueReference
for media tracking). It could have one method like:object Copy(object input);
- We create an external component to handle
ContentService.Copying
, the event handler will use the currentIContent
along with thePropertyEditorCollection
to figure out if any of theIDataValueEditor
s being used for any of the properties implementIDataValueCopying
and if so, will invoke theCopy
method and set the new property value to the result. - the
NestedContentPropertyValueEditor
then implements this interface and it will have to deal with having nested nested contents but that shouldn’t be too difficult.
Original submitted issue
When we copy pages with Nested Content and edit a published element the copied page still shows values from the original content. For example an image block where we changed the image still gives us the original image when checking the strongly typed model. The source value of the property does update properly, as demonstrated in the image below:
Reproduction
- Create a page with nested content
- copy the page
- change a property of a block in the nested content
- check the return values.
This bug appears in Umbraco version 8.0.2
This item has been added to our backlog AB#6684
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:55 (40 by maintainers)
Thanks @creativesuspects! Still think that we need to address this in the core, we should not expect the average developer or beginner to find this issue here and apply the fix. Why not apply the fix in core until the underlying problem is solved? @Shazwazza what do you say?
@nul800sebastiaan @rbottema Okay, so that seems to work. Also, I just realized I had previously been reloading Memory Cache before reloading the Database Cache, so that might have been an issue as well. Like I said, it was very late.
I have only tested it on a very small site with only a few content nodes, but I’m going to do some more testing on a larger site with multiple language variants to make sure it works.
So to sum it all up, here’s what I did: