We have recently upgraded our Sitecore form Sitecore 8.2 to Sitecore 10.1 and have migrated vanilla Sitecore sites to SXA sites. So far so good! Then what's the problem?
THE PROBLEM
One random day, a content author (lets name him GhanSingh) opened a page in Experience Editor, edited it and then saved it. May be he didn't like his changes and he thought of checking older versions of the page. He went to the page in the Content Editor and tried to check old versions of the page and to his surprise he saw something like this -
Do you notice how older versions of the page also show same Statistics data (last modified date, last modified by etc.) as the most recent version. In fact, the content author thought his actions has created multiple versions of the page and he has no way of reverting back to older versions as he don't see them anymore in the drop down. Any guesses what caused it?
THE SOLUTION
We thought it may be some custom event handler that gets triggered on item:saved or item:saving events and needs proper refactoring to work correctly. To our surprise, we didn't find anything in custom handlers which can contribute to this. We infact disabled all the customization to find its root cause but the issue kept happening.
Next step was reproducing it on a vanilla Sitecore instance and honestly, we didn't expected it to be reproducible there and it didn't reproduce either. Then we installed SXA on vanilla Sitecore instance and tried to reproduce the problem but the problem didn't reproduce.
As a next step, we started decompiling the Sitecore dlls to find all points that touch item:saving, item:saved etc. events. We started finding some potential culprits but we needed more evidence to be sure.
We enabled History Engine in Sitecore to get more details about the issue (if you are not familiar with it, I will be talking about it in a post soon) and that's where I found a stack trace referring to the following handler -
Sitecore.XA.Foundation.Publication.EventHandlers.FlagPublishingGroupingItems
This handler has an OnItemSaved() method which finds all the referrers of the saved item and if the referrer is not a SXA site page, it updates revision data of the referrer item -
Comments
Post a Comment