RESOLVED: Uncaught TypeError: Cannot read property 'parent' of null

While testing a few pages in page editor, I started running into this error:
Uncaught TypeError: Cannot read property 'parent' of null
This would happen when trying to add a new component while in edit mode. Since the error wasn't very descriptive and researching it online was leading me down the wrong path as this js error usually occurrs due to collision with jquery plugin ($ issue).

So as a trial and error method I started removing the components one by one to see if the "Add Here" buttons would show up. I was able to trace it back to a listing component that was had a couple of Partial Views included in the markup.

The culprit: Using @Html.PartialView() to rendering partial views within a view rendering.

The fix: For the time being I am checking the Page Mode to load or skip the partial views.

 I know this is not the best solution. Please let me know if someone has a better solution.

I was looking to statically bind the renderings instead of using Partial View html helper from MVC but I am unable to pass the model as a parameter. Let me know if any one has any suggestions.

Comments

Popular posts from this blog

First look at Sitecore XM Cloud: Part 4 - Creating a new Site

RESOLVED: Solr Exceptions - Document contains at least one immense term in field

First look at Sitecore XM Cloud: Part 1 - Getting started with Sitecore Cloud Portal and XM Cloud Deploy