Cuando un elemento se agrega dinámicamente al componente creado, si hay un error en el elemento, la aplicación falla.
Este problema no existe cuando no se crea el artículo.
Ext.define('Test', { extend: 'Ext.panel.Panel', initComponent: function () { // make error // this.callParent(); } }); Ext.create('Ext.panel.Panel', { renderTo: Ext.getBody(), width: 400, height: 300, title: 'Application', layout: { type: 'vbox', align: 'center', }, defaults: { margin: 10, }, items: [{ xtype: 'button', iconCls: 'x-fa fa-cog', handler: function (btn) { let mainPanel = btn.up('panel'), item = Ext.create('Test'); // bug mainPanel.add(item); }, }], });Problema extraño, porque está tratando de averiguar si el desarrollador hizo algo mal durante el tiempo de ejecución.
Pero de todos modos, aquí hay una solución para su problema:
handler: function (btn) { let mainPanel = btn.up('panel'), item = Ext.create('Test'); // bug testing if(Ext.isDefined(item) && Ext.isObject(item.layout)) { mainPanel.add(item); } else { console.error(item.id + ' could not be added because of an error I made.') } },