eschutho commented on code in PR #27239: URL: https://github.com/apache/superset/pull/27239#discussion_r1503487125
########## superset-frontend/src/features/alerts/AlertReportModal.tsx: ########## @@ -548,8 +550,16 @@ const AlertReportModal: FunctionComponent<AlertReportModalProps> = ({ setting: NotificationSetting, ) => { const settings = notificationSettings.slice(); - + // if you've changed notification method + if (settings[index].method !== setting.method) { + // remove subsequent notification methods + while (settings.length - 1 > index) { + settings.pop(); + setNotificationAddState('active'); + } + } Review Comment: as much as possible, I would recommend using array.map and filter for most of this logic instead of making copies of arrays and then adding and removing elements with slice, pop, etc.. It's ok to rewrite the existing patterns here. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For additional commands, e-mail: notifications-h...@superset.apache.org