it will ALWAYS get a result back, in this case an empty IEnumberable. This means it won't look at the parents node value. It will just decide that the current node has the data I need.
In my opinion, this is inconsistent with how the other property types work and would love to see this changed.
Strange thing is that NC's code checks if the value is null or empty string, so it should be returning a null reference instead. Hmmm.
How are your dev skills? Would you be interested in looking into this further? (If not, no worries, it'll probably be a few weeks before I get around to it - due to heavy workload)
Inconsistency with regular content types
Hi,
I seem to have stumbled upon an inconsistency with Nested Content compared to normal content types.
When I have a textbox, enter data and save the node it gets written to the umbraco.config like so:
If I then remove the text from the box, the entire property is removed from the umbraco.config.
Nested Content saves the JSON data the same way. This is all fine and as expected.
HOWEVER. Upon deleting all items from my Nested Content, it will still save as JSON data with an empty array like so:
This means the property isn't removed from the umbraco.config. Which causes an inconsistency with the way GetPropertyValue<>() works.
Because when I try to retrieve this data recursively, like so:
it will ALWAYS get a result back, in this case an empty IEnumberable. This means it won't look at the parents node value. It will just decide that the current node has the data I need.
In my opinion, this is inconsistent with how the other property types work and would love to see this changed.
-Ferdy
Hi Ferdy,
Thanks for raising this... it's a very good point! :-)
I guess there are 2 things happening here, first is that the property value in the XML cache is being set as an empty string - not sure why.
The second is that
GetPropertyValue
tries to get the object value from NestedContent'sPropertyValueConverter
- that ultimately calls this code...https://github.com/umco/umbraco-nested-content/blob/develop/src/Our.Umbraco.NestedContent/Extensions/PublishedPropertyTypeExtensions.cs#L43
Strange thing is that NC's code checks if the value is null or empty string, so it should be returning a
null
reference instead. Hmmm.How are your dev skills? Would you be interested in looking into this further? (If not, no worries, it'll probably be a few weeks before I get around to it - due to heavy workload)
Alternatively, I recall a similar issue I had with Archetype... I ended up writing an extension method to handle the recursive value checker...
https://gist.github.com/leekelleher/8e85a1020179edfad29a
Cheers,
- Lee
is working on a reply...