Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Simon Dingley 1474 posts 3451 karma points c-trib
    Nov 08, 2015 @ 20:48
    Simon Dingley
    1

    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:

    Model.GetPropertyValue<IEnumerable<IPublishedContent>>("headerSlides", true)
    

    ...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

  • Lee Kelleher 4026 posts 15837 karma points MVP 13x admin c-trib
    Nov 10, 2015 @ 09:37
    Lee Kelleher
    1

    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 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)

    Thanks,
    - Lee

  • Simon Dingley 1474 posts 3451 karma points c-trib
    Nov 10, 2015 @ 12:26
    Simon Dingley
    2

    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

  • Lee Kelleher 4026 posts 15837 karma points MVP 13x admin c-trib
    Nov 10, 2015 @ 12:32
    Lee Kelleher
    0

    Awesome, thanks Simon! PR looks good - I'll merge it in (once Matt gives me the thumbs up) :-)

  • suzyb 476 posts 934 karma points
    Nov 13, 2015 @ 10:24
    suzyb
    0

    I've cloned the source and added the file changed to fix this issue in but it still doesn't seem to be getting the recursive property.

    Have I missed something.

    Ignore me I'm an idiot. I was just missing something.

  • Simon Dingley 1474 posts 3451 karma points c-trib
    Nov 13, 2015 @ 11:13
    Simon Dingley
    0

    Assuming you had to republish the node to remove the current empty value which is what I had to do in testing?

  • suzyb 476 posts 934 karma points
    Nov 13, 2015 @ 11:15
    suzyb
    1

    Yeah ;)

    Keep forgetting the golden rule, if something doesn't work, try republishing the node :p

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies