Skip to content

Commit

Permalink
fixing updateNotification setter
Browse files Browse the repository at this point in the history
  • Loading branch information
fisjac committed May 9, 2024
1 parent 5a13e64 commit 632458c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
10 changes: 4 additions & 6 deletions superset-frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion superset-frontend/src/features/alerts/AlertReportModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -553,20 +553,26 @@ const AlertReportModal: FunctionComponent<AlertReportModalProps> = ({
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');
}

if (setting.method !== undefined && notificationAddState !== 'hidden') {
setNotificationAddState('active');
}
} else {
setNotificationSettings(settings);
}
};

Expand Down

0 comments on commit 632458c

Please sign in to comment.