@@ -305,8 +305,8 @@ class MetaDataPanel extends React.Component {
305305 const metadata = this . getMetadata ( props )
306306 if ( metadataType === 'productTemplate' ) {
307307 const prodCatOptions = this . getProductCategoryOptions ( templates . productCategories )
308- const categoryValue = metadata . category ? metadata . category : prodCatOptions [ 0 ] . value
309- const subCategoryValue = metadata . subCategory ? metadata . subCategory : prodCatOptions [ 0 ] . value
308+ const categoryValue = metadata && metadata . category ? metadata . category : prodCatOptions [ 0 ] . value
309+ const subCategoryValue = metadata && metadata . subCategory ? metadata . subCategory : prodCatOptions [ 0 ] . value
310310 fields = fields . concat ( [
311311 { key : 'id' , type : 'number' } ,
312312 { key : 'name' , type : 'text' } ,
@@ -322,7 +322,7 @@ class MetaDataPanel extends React.Component {
322322 ] )
323323 } else if ( metadataType === 'projectTemplate' ) {
324324 const projectTypeOptions = this . getProductCategoryOptions ( templates . projectTypes )
325- const value = metadata . category ? metadata . category : projectTypeOptions [ 0 ] . value
325+ const value = metadata && metadata . category ? metadata . category : projectTypeOptions [ 0 ] . value
326326 fields = fields . concat ( [
327327 { key : 'id' , type : 'number' } ,
328328 { key : 'name' , type : 'text' } ,
@@ -505,6 +505,7 @@ class MetaDataPanel extends React.Component {
505505 removeAttachment = { ( ) => { } }
506506 attachmentsStorePath = { 'dummy' }
507507 canManageAttachments
508+ productTemplates = { this . props . templates . productTemplates }
508509 />
509510 < div className = "section-footer section-footer-spec" >
510511 < button className = "tc-btn tc-btn-primary tc-btn-md" type = "submit" > Save Changes</ button >
0 commit comments