callumbwhyte / meganav

A flexible, draggable link picker for constructing site navigation menus in Umbraco
MIT License
35 stars 34 forks source link

Populate from tree - Missing error message #55

Closed eden-jh closed 2 years ago

eden-jh commented 2 years ago

Populate from tree property action silently fails if the content node has no children. There's a console error, but a non-technical content editor has no way of knowing what went wrong.

The console error is:

TypeError: can't access property "forEach", result.items is null
populateContent editor.controller.js:188

For context, the Meganav property editor in this specific instance is being used in a standalone navigation document type, which can't have any children. It gets selected by a parent item via a multinode treepicker.

A Demo Site Navigation content node shown in the Backoffice Content section. It has a Demo Site parent node, and no children. Its Links property uses the Meganav editor, and has its property actions open to show the Populate from tree option. The browser console shows the error message

I have a related feature request for the Populate from tree feature (which may impact how/whether this issue is resolved) that I'm about to create and will link to this one shortly.

callumbwhyte commented 2 years ago

Closing this as I feel the solution proposed on #56 eliminates this issue. Regardless, a fix to prevent the console error has been pushed in https://github.com/callumbwhyte/meganav/commit/03588dfbd19b4d37c8d265d220eee12682cb5d92 which I will release with v2.0.2 / v3.0.2 shortly.