After upgrading to Sitecore to 9.2 and SXA 1.9, personalisation on all renderings started to fail.

When the page loads for the first time, the item is rendered as expected, however, any subsequent page refreshes result in rendering item not being displayed.

public class MyComponentRepository : ModelRepository, IMyComponentRepository
    public override IRenderingModelBase GetModel()
        MyComponentModel model = new MyComponentModel();
        var checkDataSource = model.DataSourceItem;
        return model;

I found var checkDataSource = model.DataSourceItem; was returning null on page refresh.

  • We have recently noticed that. Looks like there is a problem with local data sources and personalization. We have registered an issue for this in our backlog. – Dawid Rutkowski Oct 2 '19 at 8:39

So, I inspected FillBaseProperties(model) in the Sitecore.XA.Foundation.MVC dll:

IRenderingModelBase renderingModelBase = (IRenderingModelBase)model;
renderingModelBase.Item = this.Rendering.Item;
renderingModelBase.PageItem = this.PageContext.Current;
renderingModelBase.Rendering = this.Rendering;
renderingModelBase.DataSourceItem = this.Rendering.DataSourceItem;

I found that on first load, the this.Rendering.DataSourceItem was populated with Sitecore Item GUID, however, on subsequent page refreshes, it was null. The this.Rendering.DataSource was always populated with "local:/Data/myDataItem".

Sitecore Support have confirmed that this is a bug (reference number 362374) and have suggested the following fix which resolved our issue:

Go to App_Config\Modules\SXA\Foundation\Sitecore.XA.Foundation.XConnectIntegration.config and change the following entry:

 <processor patch:after="*[@type='Sitecore.ContentTesting.Mvc.Pipelines.Response.CustomizeRendering.SelectVariation, Sitecore.ContentTesting.Mvc']" type="Sitecore.XA.Foundation.LocalDatasources.Pipelines.CustomizeRendering.ResolveRenderingDatasource, Sitecore.XA.Foundation.XConnect.Integration" resolve="true" />

To the following one:

   <processor patch:after="*[@type='Sitecore.Mvc.Analytics.Pipelines.Response.CustomizeRendering.Personalize, Sitecore.Mvc.Analytics']" type="Sitecore.XA.Foundation.LocalDatasources.Pipelines.CustomizeRendering.ResolveRenderingDatasource, Sitecore.XA.Foundation.XConnect.Integration" resolve="true" />

Also make sure that your web.config has the following app setting with the value 'sxaxconnect':

    <add key="sxaxm:define" value="sxaxconnect" />
| improve this answer | |
  • Adding this back in as an answer, as "Its a bug and here is the reference number" is the answer for now. – Richard Seal Oct 2 '19 at 15:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.