I came across this error on the Divi Theme.
This is how I got it fixed... It will probably work for you as well.
Divi/includes/builder/script/builder.js
Replace these lines (2 total)
if ( view['model']['attributes']['parent'] === parent_id )
With these lines
if ( view !== undefined && view['model']['attributes']['parent'] === parent_id )
And replace these 2 functions
getNumberOf : function( element_name, module_cid ) {
var views = this.get( 'views' ),
num = 0;
_.each( views, function( view ) {
var type = view['model']['attributes']['type'];
if ( view['model']['attributes']['parent'] === module_cid && ( type === element_name || type === ( element_name + '_inner' ) ) )
num++;
} );
return num;
},
getNumberOfModules : function( module_name ) {
var views = this.get( 'views' ),
num = 0;
_.each( views, function( view ) {
if ( view['model']['attributes']['type'] === module_name )
num++;
} );
return num;
},
With these
getNumberOf : function( element_name, module_cid ) {
var views = this.get( 'views' ),
num = 0;
_.each( views, function( view ) {
if(view !== undefined){
var type = view['model']['attributes']['type'];
if ( view['model']['attributes']['parent'] === module_cid && ( type === element_name || type === ( element_name + '_inner' ) ) )
num++;
}
} );
return num;
},
getNumberOfModules : function( module_name ) {
var views = this.get( 'views' ),
num = 0;
_.each( views, function( view ) {
if(view !== undefined){
if ( view['model']['attributes']['type'] === module_name )
num++;
}
} );
return num;
},