eschutho commented on code in PR #29846:
URL: https://github.com/apache/superset/pull/29846#discussion_r1706184179


##########
superset-frontend/src/features/alerts/components/NotificationMethod.tsx:
##########
@@ -257,51 +259,47 @@ export const NotificationMethod: 
FunctionComponent<NotificationMethodProps> = ({
   };
 
   useEffect(() => {
-    if (
-      method &&
-      [
-        NotificationMethodOption.Slack,
-        NotificationMethodOption.SlackV2,
-      ].includes(method) &&
-      !slackOptions[0]?.options.length
-    ) {
+    if (!slackOptions[0]?.options.length) {
       fetchSlackChannels({ types: ['public_channel', 'private_channel'] })
         .then(({ json }) => {
           const { result } = json;
-
           const options: SlackOptionsType = mapChannelsToOptions(result);
 
           setSlackOptions(options);
 
           if (isFeatureEnabled(FeatureFlag.AlertReportSlackV2)) {
-            // map existing ids to names for display
+            // for edit mode, map existing ids to names for display if slack v2
             // or names to ids if slack v1
             const [publicOptions, privateOptions] = options;
-
-            setSlackRecipients(
-              mapSlackValues({
-                method,
-                recipientValue,
-                slackOptions: [
-                  ...publicOptions.options,
-                  ...privateOptions.options,
-                ],
-              }),
-            );
-            if (method === NotificationMethodOption.Slack) {
-              onMethodChange({
-                label: NotificationMethodOption.Slack,
-                value: NotificationMethodOption.SlackV2,
-              });
+            if (
+              method &&

Review Comment:
   It's to help typescript assert that the value exists, rather than runtime 
execution. e.g., for `NotificationMethodOption` as it doesn't include 
`undefined`. I could coerce the type, but I think that sometimes looks like a 
shortcut, too. wdyt?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to