fix update severity (#56527)

This commit is contained in:
Xavier Mouligneau 2020-01-31 16:32:30 -05:00 committed by GitHub
parent c72e8e0986
commit 3601602feb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -168,7 +168,6 @@ const StepAboutRuleComponent: FC<StepAboutRuleProps> = ({
min: 0,
fullWidth: false,
disabled: isLoading,
options: severityOptions,
showTicks: true,
tickInterval: 25,
},
@ -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;