Insights

Component Datasource Not Displaying After Publish In Sitecore SXA

Sitecore SXA Not Displaying Component Datasource After Publish

In a recent client's environment, running Sitecore 10.1.0 with SXA, we experienced an unusual issue when it came to publishing. Certain parts of the page, recently authored, would not be shown in the Content Delivery environment. When we viewed the same page in the CM environment via the web db, the page rendered as expected.

The Issue

An author would create / edit a page in Experience Editor, add an SXA component, add a datasource to that component and save. The component would typically be in workflow, but this issue is not restricted to components in workflow.

Back in Content Editor the author would publish only the page that the component was added on. They would then approve the component's workflow and then publish the page and all sub items. However, after publishing the component and it's datasource would not appear on the page while viewing on the CD server. So what was happening?

The Cause

It turns out that, after some sleuthing and working with Sitecore Support, that the problem was related to caching. And in particular, the clearing of the web[paths] cache upon publish. By default, the cache is set to false, as shown below.

<setting name="Caching.CacheKeyIndexingEnabled.PathCache" value="false"/>

As part of your cache management strategy, you may have set it to true, as we had. This was only set to true on, you guessed it, the CD server.

The Solution

As documented in the public reference number, 157425, the bug in question incorrectly clears when Caching.CacheKeyIndexingEnabled.PathCache is set to true. Therefore the simplest solution is setting it to false.

If you're experiencing something similar where components and / or their datasources are not displaying after a publish, have a look and see if this setting is set to true.

Meet David Austin

Development Team Lead

📷🕹️👪

David is a decorated Development Team Lead with Sitecore Technology MVP and Coveo MVP awards, as well as Sitecore CDP & Personalize Certified. He's worked in IT for 25 years; everything ranging from Developer to Business Analyst to Group Lead helping manage everything from Intranet and Internet sites to facility management and application support. David is a dedicated family man who loves to spend time with his girls. He's also an avid photographer and loves to explore new places.

Connect with David