Skip to content

Commit b252f02

Browse files
authored
Merge pull request #3813 from vigneshTheDev/fix-3634
Fix issue #3634 for tabs
2 parents d34675a + 3d71be6 commit b252f02

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/projects/detail/components/SkillsQuestion/SkillsQuestion.jsx

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,16 +98,22 @@ class SkillsQuestion extends React.Component {
9898
const indexOfSpace = value.indexOf(' ')
9999
const indexOfSemiColon = value.indexOf(';')
100100

101-
// if user enter only ' ' or ';' we should clean it to not allow
101+
// if user enter ' ' or ';' in the start of the input, we should clean it to not allow
102102
if (indexOfSpace === 0 || indexOfSemiColon === 0 ) {
103-
return ''
103+
return value.slice(1)
104104
}
105105

106106
if (indexOfSemiColon >= 1 ) {
107+
const newValue = value.replace(';', '').trim()
107108
const currentValues = getValue()
108-
this.handleChange([...currentValues, { name: value.substring(0, value.length -1) }])
109-
// this is return empty to nullify value post processing
110-
return ''
109+
if (!_.some(currentValues, v => v && v.name === newValue)) {
110+
this.handleChange([...currentValues, { name: newValue}])
111+
// this is return empty to nullify value post processing
112+
return ''
113+
} else {
114+
// don't allow semicolon for duplicate values
115+
return value.replace(';', '')
116+
}
111117
}
112118

113119
this.setState({ customOptionValue: value })
@@ -172,7 +178,7 @@ class SkillsQuestion extends React.Component {
172178
placeholder="Start typing a skill then select from the list"
173179
value={selectGroupValues}
174180
getOptionLabel={(option) => option.name || ''}
175-
getOptionValue={(option) => option.name || ''}
181+
getOptionValue={(option) => (option.name || '').trim()}
176182
onInputChange={this.onSelectType}
177183
onChange={(val) => {
178184
this.handleChange(_.union(val, checkboxGroupValues))

0 commit comments

Comments
 (0)