_addComponentsFromDef Issue loading view

Hi,

we created a custom module that is related to opportunities. When we open the opportunity we have a subpanel to shows the related records. So far so good. But when a user clicks the specified record on the custom module something strange happens. For some reason we do receive the following javascript error: 

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
components_732f65a3ae4ebba78bd0c391d47ef8d0.js:84815 Uncaught (in promise) TypeError: Cannot read property 'link' of undefined
at child.<anonymous> (components_732f65a3ae4ebba78bd0c391d47ef8d0.js:84815)
at eval (eval at e.exports (addScript.js:9), <anonymous>:5:751)
at eval (eval at e.exports (addScript.js:9), <anonymous>:5:2672)
at Function.h.each.h.forEach (eval at e.exports (addScript.js:9), <anonymous>:5:1934)
at Function.h.filter.h.select (eval at e.exports (addScript.js:9), <anonymous>:5:2649)
at child._pruneHiddenComponents (components_732f65a3ae4ebba78bd0c391d47ef8d0.js:84814)
at child._addComponentsFromDef (components_732f65a3ae4ebba78bd0c391d47ef8d0.js:84835)
at child.initComponents (layout.js:240)
at layout.js:245
at Function.h.each.h.forEach (eval at e.exports (addScript.js:9), <anonymous>:5:1934)
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

I traced it back to the following javascript part: 

clients/base/layouts/subpanels/subpanels.js:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
_pruneHiddenComponents: function(components) {
var hiddenSubpanels = app.metadata.getHiddenSubpanels();
var visibleSubpanels = _.filter(components, function(component){
// for some reason the component does not have a 'context' and therefore the 'link' property can not be found
var relatedModule = app.data.getRelatedModule(this.module, component.context.link);
return _.isEmpty(_.find(hiddenSubpanels, function(hiddenPanel){
if (relatedModule !== false) {
//hidden subpanels seem to come back in lower case, so we do a case insenstiive compare of module names
return hiddenPanel.toLowerCase() === relatedModule.toLowerCase();
}
return true;
}));
}, this);
return visibleSubpanels;
},
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

The question is why does this error occure? It seems that the component is a subpanel on that specific module that is not loaded correctly. I can't seem to find the cause of the issue. Did someone encounter similar issues in 10.2? and if so how can we fix it?