fix(alerts/reports): misconfigured useEffect hook breaks form validation in prod builds (#12779)

This commit is contained in:
ʈᵃᵢ 2021-01-26 13:44:15 -08:00 committed by GitHub
parent 017f11f9d8
commit 3ed915146d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 21 deletions

View File

@ -992,27 +992,23 @@ const AlertReportModal: FunctionComponent<AlertReportModalProps> = ({
}, [resource]);
// Validation
useEffect(
() => {
validate();
},
currentAlert
? [
currentAlert.name,
currentAlert.owners,
currentAlert.database,
currentAlert.sql,
currentAlert.validator_config_json,
currentAlert.crontab,
currentAlert.working_timeout,
currentAlert.dashboard,
currentAlert.chart,
contentType,
notificationSettings,
conditionNotNull,
]
: [],
);
const currentAlertSafe = currentAlert || {};
useEffect(() => {
validate();
}, [
currentAlertSafe.name,
currentAlertSafe.owners,
currentAlertSafe.database,
currentAlertSafe.sql,
currentAlertSafe.validator_config_json,
currentAlertSafe.crontab,
currentAlertSafe.working_timeout,
currentAlertSafe.dashboard,
currentAlertSafe.chart,
contentType,
notificationSettings,
conditionNotNull,
]);
// Show/hide
if (isHidden && show) {