Skip to content

Commit 9642b32

Browse files
author
Vikas Agarwal
committed
fix: git#848-No validation message displayed when user clicks on the Save draft
1 parent 39a10a6 commit 9642b32

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/components/ChallengeEditor/TagsField/index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import styles from './Tags-Field.module.scss'
66

77
const TagsField = ({ challengeTags, challenge, onUpdateMultiSelect, readOnly }) => {
88
const mapOps = item => ({ label: item.name, value: item.id })
9+
const existingTags = (challenge.tags && challenge.tags.length) ? challenge.tags.join(',') : ''
910
return (
1011
<>
1112
<div className={styles.row}>
@@ -15,19 +16,19 @@ const TagsField = ({ challengeTags, challenge, onUpdateMultiSelect, readOnly })
1516
<div className={cn(styles.field, styles.col2)}>
1617
<input type='hidden' />
1718
{readOnly ? (
18-
<span>{(challenge.tags && challenge.tags.length) ? challenge.tags.join(', ') : ''}</span>
19+
<span>{existingTags}</span>
1920
) : (<Select
2021
id='track-select'
2122
multi
2223
options={challengeTags.map(mapOps)}
2324
simpleValue
24-
value={(challenge.tags && challenge.tags.length) ? challenge.tags.join(',') : ''}
25+
value={existingTags}
2526
onChange={(value) => onUpdateMultiSelect(value, 'tags')}
2627
/>)}
2728
</div>
2829
</div>
2930

30-
{ !readOnly && challenge.submitTriggered && !challenge.tags.length && <div className={styles.row}>
31+
{ !readOnly && challenge.submitTriggered && (!challenge.tags || !challenge.tags.length) && <div className={styles.row}>
3132
<div className={cn(styles.field, styles.col1)} />
3233
<div className={cn(styles.field, styles.col2, styles.error)}>
3334
Select at least one tag

src/components/ChallengeEditor/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ class ChallengeEditor extends Component {
597597
}
598598

599599
isValidChallengePrizes () {
600-
const challengePrizes = this.state.challenge.prizeSets.find(p => p.type === PRIZE_SETS_TYPE.CHALLENGE_PRIZES)
600+
const challengePrizes = _.find(this.state.challenge.prizeSets, p => p.type === PRIZE_SETS_TYPE.CHALLENGE_PRIZES, [])
601601
if (!challengePrizes || !challengePrizes.prizes || challengePrizes.prizes.length === 0) {
602602
return false
603603
}

0 commit comments

Comments
 (0)