What causes "Published (pending changes)"

Hi community!

We are using Umbraco 17 and have built a large synchronization process for a client that automatically imports nodes every night.

During this synchronization, we perform a save and publish action via code. This seems to work correctly, and we can also see the publish action in the node’s history.

However, the node does not get the status “Published”, but instead remains “Published (pending changes)”. There is no open draft, and it is not a case where only a save action was performed; the most recent action in the history is actually a publish action.

What makes this even more interesting is that if we perform another save followed by a publish action via code on a node with the status “Published (pending changes)”, the status still remains “Published (pending changes)”.

However, if we perform the same actions through the UI in the backoffice, the status changes to “Published” as expected. So it seems that the backoffice publishes a clean version of the node, while our programmatic approach does not.

My specific questions are:

  • What causes the “Published (pending changes)” status in Umbraco 17?

  • How can we programmatically ensure that a node gets the “Published” status after publishing?

How are you publishing in code? Sounds to me like, you are not publishing, or publishing fails after saving.

Thanks for your quick response!

Using the IContentService, we first perform a save action, followed by a publish. Publishing is optional in our business logic, but I can confirm that in this particular case, a publish is indeed being performed.


// Batched save
_contentService.Save(contents.Values);

foreach (var content in contents.Values)
{
    PublishIfNeccessary(content);
}

Then the following action:

private void PublishIfNeccessary(IContent content)
{    
    // Try fetching published content    
    var publishedContent = _publishedContentCache.GetById(false, content.Key);
    if (publishedContent == null)    
    {        
         // If not found, it means the content is currently unpublished, so keep it unpublished        
        return;    
    }    

    if (!ProductRoutingHelper.HasValidUrl(publishedContent))    
    {        
        return;    
    }    

    var publishResult = _contentService.Publish(content, ["*"]);
}

This can also be seen in the node’s history:

Maybe I should make my question a bit more specific. I can’t find any information on what exactly triggers the “Pending Changes” status.

Ideally, we would like to run a one-time action programmatically to address the underlying cause and change the status of all affected nodes to “Published” in one go.

Hi @JoppeRuessink

Maybe you could share a bit more regarding your Document Type configuration.

Does it vary by culture?

Do you have a shared Block Editor in a property, that has Block that vary by culture(Using Element Types that varies by Culture)

Do you have any custom property editors, with custom converters?

This will give an insight into your data and why it triggers the Pending changes state(Changes that has not been published yet)

Best, Niels

Hi @JoppeRuessink & @nielslyngsoe,

We are experiencing exactly the same problem. Even when we do something like:

foreach (IContent product in allProducts) {
_contentService.Publish(product, ["*"]);
}

All products are set to “pending changes”. We do not use a blocklist. In our case, they are Commerce products. They do have a number of actions during the Save process, but even disabling these actions does not help.

Have you happened to find a solution yet?

Dave

ps. If we press the “Save & Publish” button in the CMS everything works… It’s just when we publish in code. But we don’t want to publish 98.000+ products by hand :laughing: