Hello Sitecore fellows,
As we are in a process of upgrading our version to Sitecore 9.1,
we are facing new challenges as a part of the journey.
That said, a very good quote which says.
“Enjoy
the journey and try to get better every day. And don’t lose the passion and the
love for what you do.”
We were able to successfully deploy code to our new Sitecore
9.1 (initial release) and most of the things went well except one and which was
a big one “Experience Editor”.
When we tried to add any component to a page in Experience
Editor with its data source item it started to give us a JavaScript alert in browser
as well as error in console.
This was something that I haven’t faced before and looking
at the console error it looked to be a generic error.
The error says,
The error says,
“could not find the
rendering in the Html loaded from the server”
I Googled this error and found
We raised a support ticket for better understanding of the issue,
and they asked us to capture the fiddler session of the same.
Sitecore Support came up with an answer as below,
“I believe the issue
lies within GET vs POST request. In Sitecore 9.0 onwards, Experience Editor
architecture was changed and part of this included some requests making a POST
request which initially were making a GET request.
I compared the
"Palette.aspx" call from your fiddler session to mine. In the
response of this POST call, in yours, there is no element with ' id="r_****" ',
this implies that the POST request was not handled on controller side if I am
not mistaken.
I would encourage
checking your Controller handling and change to handle POST request rather than
GET. “
Ours is a Multisite Solution and we have many re-usable
components which are used across the sites and it seemed to be a very time-consuming
process to check each component in the solution.
But for every problem there is a Solution and we found one.
Suddenly for one of the Site which had fewer content pages, Experience
Editor was working. But for our 2 main sites it was not.
As mentioned previously we have components which are re-usable
across all the Sites, I decided to use a trick.
The home page for all the Sites were almost identical except
one component.
It was a Search Component which was different from the one
where the Experience Editor was working, and it was a global component which is used on
all the pages.
I removed the search component from the page and tried to
add a component and it worked.
I was successfully able to add a component to the page.
Now what's there in that component which is not allowing the
experience editor to function?
In the POST request at the end of the code it was basically
doing Redirect to a particular URL and that was causing conflict with the
Experience Editor POST method.
The Solution was simple. I added below line of code and was
able to fix the issue
if (!Sitecore.Context.PageMode.IsExperienceEditorEditing)
return Redirect(redirectUrl);
return Redirect(redirectUrl);
Phewwww…. and the Experience Editor started working.
Note : Thanks to Yogini Zope for Identifying that it worked for one
of the sites.