Skip to content

Commit

Permalink
fix update severity (#56527)
Browse files Browse the repository at this point in the history
  • Loading branch information
XavierM authored Jan 31, 2020
1 parent c72e8e0 commit 3601602
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ const StepAboutRuleComponent: FC<StepAboutRuleProps> = ({
min: 0,
fullWidth: false,
disabled: isLoading,
options: severityOptions,
showTicks: true,
tickInterval: 25,
},
Expand Down Expand Up @@ -239,8 +238,13 @@ const StepAboutRuleComponent: FC<StepAboutRuleProps> = ({
<FormDataProvider pathsToWatch="severity">
{({ severity }) => {
const newRiskScore = defaultRiskScoreBySeverity[severity as SeverityValue];
const severityField = form.getFields().severity;
const riskScoreField = form.getFields().riskScore;
if (newRiskScore != null && riskScoreField.value !== newRiskScore) {
if (
severityField.value !== severity &&
newRiskScore != null &&
riskScoreField.value !== newRiskScore
) {
riskScoreField.setValue(newRiskScore);
}
return null;
Expand Down

0 comments on commit 3601602

Please sign in to comment.