bito-code-review[bot] commented on code in PR #37131:
URL: https://github.com/apache/superset/pull/37131#discussion_r2691784107


##########
superset-frontend/src/explore/components/useExploreAdditionalActionsMenu/index.jsx:
##########
@@ -204,13 +204,8 @@ export const useExploreAdditionalActionsMenu = (
   const shareByEmail = useCallback(async () => {
     try {
       const subject = t('Superset Chart');
-      const result = await getChartPermalink(latestQueryFormData);
-      if (!result?.url) {
-        throw new Error('Failed to generate permalink');
-      }
-      const body = encodeURIComponent(
-        t('%s%s', 'Check out this chart: ', result.url),
-      );
+      const url = await getChartPermalink(latestQueryFormData);

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Permalink handling bug</b></div>
   <div id="fix">
   
   The getChartPermalink function returns an object {key, url}, but the code 
assigns the entire object to 'url' and uses it as a string in the email body 
interpolation. This will result in '[object Object]' in the email. 
Additionally, the error handling for missing url was removed, which could lead 
to emails containing 'undefined' if the permalink fails to generate.
   </div>
   
   
   <details>
   <summary>
   <b>Code suggestion</b>
   </summary>
   <blockquote>Check the AI-generated fix before applying</blockquote>
   <div id="code">
   
   
   ````suggestion
         const { url } = await getChartPermalink(latestQueryFormData);
   ````
   
   </div>
   </details>
   
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #effd4d</i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a 
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



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