Skip to content

Commit 060554c

Browse files
committed
fix: show the duplicate reviewer config error on saving
1 parent 64c9525 commit 060554c

File tree

1 file changed

+0
-5
lines changed

1 file changed

+0
-5
lines changed

src/components/ChallengeEditor/index.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -906,7 +906,6 @@ class ChallengeEditor extends Component {
906906

907907
const counts = {}
908908
reviewers.forEach(r => {
909-
// count only manual (member) reviewers; AI reviewers have isMemberReview === false
910909
if (r && (r.isMemberReview !== false) && r.phaseId) {
911910
const pid = String(r.phaseId)
912911
counts[pid] = (counts[pid] || 0) + 1
@@ -923,26 +922,22 @@ class ChallengeEditor extends Component {
923922
}
924923

925924
validateChallenge () {
926-
// First run the existing validations
927925
if (this.isValidChallenge()) {
928926
// Additional validation: block saving draft if there are duplicate manual reviewer configs per phase
929927
const duplicates = this.getDuplicateManualReviewerPhases()
930928
if (duplicates && duplicates.length > 0) {
931929
const message = `Duplicate manual reviewer configuration found for phase${duplicates.length > 1 ? 's' : ''}: ${duplicates.join(', ')}. Only one manual reviewer configuration is allowed per phase.`
932-
// Surface the message to the top-level error so the UI shows it and prevent saving
933930
this.setState({ hasValidationErrors: true, error: message })
934931
return false
935932
}
936933

937-
// clear any previous error related to this validation
938934
if (this.state.error) {
939935
this.setState({ error: null })
940936
}
941937
this.setState({ hasValidationErrors: false })
942938
return true
943939
}
944940

945-
// If base validation failed, mark submitTriggered so fields show their validation errors
946941
this.setState(prevState => ({
947942
...prevState,
948943
challenge: {

0 commit comments

Comments
 (0)