Skip to content

Commit

Permalink
fix(alerts/reports): misconfigured useEffect hook breaks form validat…
Browse files Browse the repository at this point in the history
…ion in prod builds (apache#12779)
  • Loading branch information
nytai authored Jan 26, 2021
1 parent 017f11f commit 3ed9151
Showing 1 changed file with 17 additions and 21 deletions.
38 changes: 17 additions & 21 deletions superset-frontend/src/views/CRUD/alert/AlertReportModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 3ed9151

Please sign in to comment.