Copilot commented on code in PR #34178:
URL: https://github.com/apache/superset/pull/34178#discussion_r2210604463


##########
superset-frontend/src/dashboard/components/menu/ShareMenuItems/index.tsx:
##########
@@ -96,20 +97,23 @@ const ShareMenuItems = (props: ShareMenuItemProps) => {
     }
   }
 
-  return (
-    <Menu.SubMenu
-      title={title}
-      key={MenuKeys.Share}
-      disabled={disabled}
-      {...rest}
-    >
-      <Menu.Item key={MenuKeys.CopyLink} onClick={() => onCopyLink()}>
-        {copyMenuItemTitle}
-      </Menu.Item>
-      <Menu.Item key={MenuKeys.ShareByEmail} onClick={() => onShareByEmail()}>
-        {emailMenuItemTitle}
-      </Menu.Item>
-    </Menu.SubMenu>
-  );
+  return {
+    type: 'submenu',
+    label: title,
+    key: MenuKeys.Share,
+    disabled,
+    children: [
+      {
+        key: MenuKeys.CopyLink,
+        label: copyMenuItemTitle,
+        onClick: () => onCopyLink,
+      },
+      {
+        key: MenuKeys.ShareByEmail,
+        label: emailMenuItemTitle,
+        onClick: () => onShareByEmail,

Review Comment:
   The onClick handler returns the function reference instead of invoking it. 
It should be either `onClick: onCopyLink` or `onClick: () => onCopyLink()` to 
actually execute the copy logic.
   ```suggestion
           onClick: () => onCopyLink(),
         },
         {
           key: MenuKeys.ShareByEmail,
           label: emailMenuItemTitle,
           onClick: () => onShareByEmail(),
   ```



##########
superset-frontend/src/dashboard/components/menu/ShareMenuItems/index.tsx:
##########
@@ -54,6 +54,7 @@ const ShareMenuItems = (props: ShareMenuItemProps) => {
     dashboardComponentId,
     title,
     disabled,
+    children,

Review Comment:
   [nitpick] The `children` prop is destructured but not used within this hook. 
Removing it will clean up the props signature.
   ```suggestion
   
   ```



##########
superset-frontend/src/dashboard/components/menu/ShareMenuItems/index.tsx:
##########
@@ -96,20 +97,23 @@ const ShareMenuItems = (props: ShareMenuItemProps) => {
     }
   }
 
-  return (
-    <Menu.SubMenu
-      title={title}
-      key={MenuKeys.Share}
-      disabled={disabled}
-      {...rest}
-    >
-      <Menu.Item key={MenuKeys.CopyLink} onClick={() => onCopyLink()}>
-        {copyMenuItemTitle}
-      </Menu.Item>
-      <Menu.Item key={MenuKeys.ShareByEmail} onClick={() => onShareByEmail()}>
-        {emailMenuItemTitle}
-      </Menu.Item>
-    </Menu.SubMenu>
-  );
+  return {
+    type: 'submenu',
+    label: title,
+    key: MenuKeys.Share,
+    disabled,
+    children: [
+      {
+        key: MenuKeys.CopyLink,
+        label: copyMenuItemTitle,
+        onClick: () => onCopyLink,
+      },
+      {
+        key: MenuKeys.ShareByEmail,
+        label: emailMenuItemTitle,
+        onClick: () => onShareByEmail,

Review Comment:
   The onClick handler returns the function reference instead of invoking it. 
It should be either `onClick: onShareByEmail` or `onClick: () => 
onShareByEmail()` to actually open the email share dialog.
   ```suggestion
           onClick: onCopyLink,
         },
         {
           key: MenuKeys.ShareByEmail,
           label: emailMenuItemTitle,
           onClick: onShareByEmail,
   ```



-- 
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