Copied to clipboard

Flag this post as spam?

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


  • Lee Higgitt 9 posts 90 karma points
    Nov 17, 2020 @ 15:01
    Lee Higgitt
    0

    Child components not available in preview when parent is unpublsished

    We're using USkinned. It has page nodes, under each page node it has a page components folder node and then page component nodes under there (see image below).

    enter image description here

    I have a problem where, when in preview mode, if the parent page component is unpublished, it wont render the child page components on the page regardless to whether they're published or not.

    If I try to preview the child component directly (which should redirect to the parent page component) then I get an error in the Uskinned base controller (set as the default render MVC controller).

    It tries to get the home node using model.Content.AncestorOrSelf(1) but that is apparently null as the exception I'm getting is a null reference exception when calling homeNode.IsDocumentType(blah):

        public override ActionResult Index(ContentModel model)
        {
            IPublishedConterent homeNode = model.Content.AncestorOrSelf(1);
            USNBaseViewModel customModel = new USNBaseViewModel(model.Content);
    
            if (homeNode.IsDocumentType("USNHomepage")) <<< null ref exception here.
    

    The odd thing is that it works fine when I'm debugging, I only have this issue in the production environment making it very hard for me to figure out what the problem is!

    Has any one else had these issues or have any clue what could be causing it?

Please Sign in or register to post replies

Write your reply to:

Draft