@@ -19,7 +19,7 @@ export class CardItem extends React.Component<DevFileProps, {
1919 numOfCall : number ,
2020 isExpanded : boolean ,
2121 devFileYAML : string ,
22- selectedProject : StarterProject ,
22+ selectedProject : null | StarterProject ,
2323 copyClicked : boolean
2424 hoverProject : null | StarterProject
2525} > {
@@ -30,7 +30,7 @@ export class CardItem extends React.Component<DevFileProps, {
3030 numOfCall : 0 ,
3131 isExpanded : false ,
3232 devFileYAML : '' ,
33- selectedProject : this . props . compDescription . devfileData . devfile . starterProjects [ 0 ] ,
33+ selectedProject : this . props . compDescription . devfileData . devfile . starterProjects ? this . props . compDescription . devfileData . devfile . starterProjects [ 0 ] : null ,
3434 copyClicked : false ,
3535 hoverProject : null
3636 } ;
@@ -49,7 +49,7 @@ export class CardItem extends React.Component<DevFileProps, {
4949 numOfCall,
5050 isExpanded,
5151 devFileYAML,
52- selectedProject : this . props . compDescription . devfileData . devfile . starterProjects [ 0 ]
52+ selectedProject : this . props . compDescription . devfileData . devfile . starterProjects ? this . props . compDescription . devfileData . devfile . starterProjects [ 0 ] : null ,
5353 } ) ;
5454 }
5555 } ) ;
@@ -139,7 +139,7 @@ export class CardItem extends React.Component<DevFileProps, {
139139 overlap = 'rectangular'
140140 variant = 'standard'
141141 showZero = { false } >
142- { this . props . compDescription . devfileData . devfile . starterProjects . length }
142+ { this . props . compDescription . devfileData . devfile . starterProjects ? .length }
143143 </ Badge >
144144 </ div >
145145 < div >
@@ -149,14 +149,14 @@ export class CardItem extends React.Component<DevFileProps, {
149149 className = { this . props . cardItemStyle . starterProjectSelect }
150150 onMouseLeave = { ( ) : void => this . setCurrentlyHoveredProject ( null ) }
151151 >
152- { this . props . compDescription . devfileData . devfile . starterProjects . map ( ( project : StarterProject ) => (
152+ { this . props . compDescription . devfileData . devfile . starterProjects ? .map ( ( project : StarterProject ) => (
153153 < div
154154 key = { project . name }
155155 data-testid = { `projects-selector-item-${ project . name } ` }
156156 onMouseDown = { ( ) : void => this . setSelectedProject ( project ) }
157157 onMouseEnter = { ( ) : void => this . setCurrentlyHoveredProject ( project ) }
158158 className = {
159- selectedProject . name === project . name ? this . props . cardItemStyle . starterProjectSelected : this . props . cardItemStyle . project
159+ selectedProject ? .name === project ? .name ? this . props . cardItemStyle . starterProjectSelected : this . props . cardItemStyle . project
160160 }
161161 >
162162 { project . name }
@@ -232,7 +232,7 @@ export class CardItem extends React.Component<DevFileProps, {
232232 </ div >
233233 </ div >
234234 </ div >
235- { starterProjectCard }
235+ { this . props . compDescription . devfileData . devfile . starterProjects && starterProjectCard }
236236 </ Card >
237237 </ div >
238238 < div className = { this . props . cardItemStyle . yamlCardBody } >
0 commit comments