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.


Popular posts from this blog

Google Lighthouse Tips: Importance of web page speed

Decision tree for selecting the best cloud hosting option (App service, VM, Containers, Serverless)

SOLVED: Sitecore Habitat Home Sync-Unicorn fails with the error: GetResponse" with "0" argument(s): "The remote server returned an error: (403) Forbidden.