This is an automated email from the ASF dual-hosted git repository. michaelsmolina pushed a commit to branch 4.0 in repository https://gitbox.apache.org/repos/asf/superset.git
commit 59673695ac318598c55332b052ad98a20c7b7267 Author: Jack <[email protected]> AuthorDate: Mon May 13 11:38:12 2024 -0500 fix(ar-modal): updateNotificationSettings not updating state (#28409) (cherry picked from commit d871b4d267e2e20d337939040d07dc524669ba12) --- superset-frontend/src/features/alerts/AlertReportModal.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/superset-frontend/src/features/alerts/AlertReportModal.tsx b/superset-frontend/src/features/alerts/AlertReportModal.tsx index 6eb157ab94..45e5cbe0a9 100644 --- a/superset-frontend/src/features/alerts/AlertReportModal.tsx +++ b/superset-frontend/src/features/alerts/AlertReportModal.tsx @@ -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); } };
