fix(ar-modal): updateNotificationSettings not updating state (#28409)
This commit is contained in:
parent
89dbb9888c
commit
d871b4d267
|
|
@ -553,13 +553,17 @@ 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');
|
||||
}
|
||||
|
|
@ -567,6 +571,8 @@ const AlertReportModal: FunctionComponent<AlertReportModalProps> = ({
|
|||
if (setting.method !== undefined && notificationAddState !== 'hidden') {
|
||||
setNotificationAddState('active');
|
||||
}
|
||||
} else {
|
||||
setNotificationSettings(settings);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue