diff --git a/superset-frontend/src/features/alerts/AlertReportModal.tsx b/superset-frontend/src/features/alerts/AlertReportModal.tsx index 6eb157ab94a2..45e5cbe0a94a 100644 --- a/superset-frontend/src/features/alerts/AlertReportModal.tsx +++ b/superset-frontend/src/features/alerts/AlertReportModal.tsx @@ -553,13 +553,17 @@ const AlertReportModal: FunctionComponent = ({ index: number, setting: NotificationSetting, ) => { - // if you've changed notification method + const settings: NotificationSetting[] = [...notificationSettings]; + settings[index] = setting; + + // if you've changed notification method -> remove trailing methods if (notificationSettings[index].method !== setting.method) { notificationSettings[index] = setting; setNotificationSettings( notificationSettings.filter((_, idx) => idx <= index), ); + if (notificationSettings.length - 1 > index) { setNotificationAddState('active'); } @@ -567,6 +571,8 @@ const AlertReportModal: FunctionComponent = ({ if (setting.method !== undefined && notificationAddState !== 'hidden') { setNotificationAddState('active'); } + } else { + setNotificationSettings(settings); } };