Sitecore SXA partial design cache does not clear on publish
Scenario:
When making a change to a SXA partial design and publishing, the changes are not reflected on the site.
Diagnosis:
Initially, I was suspicious of the Html Cache Clearing processor and accused them of not doing their jobs. Well, as it turns out, I was partially correct, but it had nothing to do with HTML Cache.
I began by visiting the /sitecore/admin/cache.aspx page. I cleared all of the cache and quickly saw my change reflected on the page. Armed with the knowledge of knowing it is a cache issue, I built out page that would allow me to clear each cache individually.
After a lot of clicking, I disovered that the cache responsible was the “SXA[CompositesXml]” Cache. Clearing that cache individually seem to fix my problem. I began digging into the processors responsible for clearing that cache, and found the “Sitecore.XA.Feature.Composites.EventHandlers.CompositesXmlCacheClearer” processor in the publish:end event.
So, I opened up JustDecompile and investigated my new prime suspect. It didn’t take very long to find the evidence I was looking for. Turns out, it only clears the cache if the item being published inherits from one of the following templates:
- /sitecore/templates/Feature/Experience Accelerator/Composites/Datasource/Composite Section
- /sitecore/templates/Feature/Experience Accelerator/Composites/Datasource/Composite Group
- /sitecore/templates/Foundation/Experience Accelerator/Multisite/Content/Page
Resolution:
I went to my Partial Design template, and inherited from the “Page” template above. The Page template on its own does not have any fields, so it was safe to inherit from it.
Made a change, clicked pubilsh, and all the changes instantly appeared. Just that easy!