Problems calling GetPropertyValue recursively on an empty property which previously had a value
Great package guys - thanks for sharing!
I'm using it for the first time on a project and have discovered that if a value is set and subsequently removed when the node is then published it adds an empty cdata section in the cache file e.g.
<headerSlides><![CDATA[[]]]></headerSlides>
Unfortunately this means that recursive property lookups like this:
...results in the lookup stopping on the node with the now empty cdata section and not continuing up the tree until it really does find a node with a value on that property.
Hopefully this makes sense? Before I dive into the source tomorrow I wanted to check if this was a known issue or if there is a known way around this?
Thanks for raising this. It's not a known issue (yet).
I haven't experienced this myself, but that's only because I haven't tried that scenario.
From looking at the source-code, I think it's because we return a string.Empty if the NC data is empty. I guess we should be returning a null? (For reference, it's this code line.)
Please do raise an issue on the GitHub repo... we can keep track of it there - and if you want to do a pull-request, that would be great too! (no pressure though)
Problems calling GetPropertyValue recursively on an empty property which previously had a value
Great package guys - thanks for sharing!
I'm using it for the first time on a project and have discovered that if a value is set and subsequently removed when the node is then published it adds an empty cdata section in the cache file e.g.
Unfortunately this means that recursive property lookups like this:
...results in the lookup stopping on the node with the now empty
cdata
section and not continuing up the tree until it really does find a node with a value on that property.Hopefully this makes sense? Before I dive into the source tomorrow I wanted to check if this was a known issue or if there is a known way around this?
Cheers, Simon
Hi Simon,
Thanks for raising this. It's not a known issue (yet).
I haven't experienced this myself, but that's only because I haven't tried that scenario.
From looking at the source-code, I think it's because we return a
string.Empty
if the NC data is empty. I guess we should be returning anull
? (For reference, it's this code line.)Please do raise an issue on the GitHub repo... we can keep track of it there - and if you want to do a pull-request, that would be great too! (no pressure though)
Thanks,
- Lee
Thanks Lee, pull request submitted:
https://github.com/leekelleher/umbraco-nested-content/pull/39
It was actually to do with the fact an empty collection was not returning a null or empty string.
Simon
Awesome, thanks Simon! PR looks good - I'll merge it in (once Matt gives me the thumbs up) :-)
Ignore me I'm an idiot. I was just missing something.
Assuming you had to republish the node to remove the current empty value which is what I had to do in testing?
Yeah ;)
Keep forgetting the golden rule, if something doesn't work, try republishing the node :p
is working on a reply...