File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
src/projects/detail/components/SkillsQuestion Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -112,12 +112,13 @@ class SkillsQuestion extends React.Component {
112112 const { options, customOptionValue } = this . state
113113
114114 const selectedCategories = _ . get ( currentProjectData , categoriesField , [ ] )
115- const mappedCategories = _ . map ( selectedCategories , ( category ) => categoriesMapping [ category ] ? categoriesMapping [ category ] . toLowerCase ( ) : null )
116- const availableOptions = options
117- . filter ( option => _ . intersection ( ( option . categories || [ ] ) . map ( c => c . toLowerCase ( ) ) , mappedCategories ) . length > 0 )
118- . map (
119- option => _ . pick ( option , [ 'id' , 'name' ] )
120- )
115+ const mappedCategories = categoriesMapping && _ . map ( selectedCategories , ( category ) => categoriesMapping [ category ] ? categoriesMapping [ category ] . toLowerCase ( ) : null )
116+
117+ // if have a mapping for categories, then filter options, otherwise use all options
118+ const availableOptions = ( categoriesMapping
119+ ? options . filter ( option => _ . intersection ( ( option . categories || [ ] ) . map ( c => c . toLowerCase ( ) ) , mappedCategories ) . length > 0 )
120+ : options
121+ ) . map ( option => _ . pick ( option , [ 'id' , 'name' ] ) )
121122
122123 let currentValues = getValue ( ) || [ ]
123124 // remove from currentValues not available options but still keep created custom options without id
You can’t perform that action at this time.
0 commit comments