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


##########
superset-frontend/src/features/home/Menu.tsx:
##########
@@ -19,6 +19,7 @@
 import { useState, useEffect } from 'react';
 import { styled, css, useTheme } from '@superset-ui/core';
 import { debounce } from 'lodash';
+import { assetUrlIf } from 'src/utils/assetUrl';

Review Comment:
   
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Browser compatibility issue</b></div>
   <div id="fix">
   
   The `assetUrlIf` function being imported uses `URL.canParse()` which is not 
supported in older browsers including Safari versions before 17.2. This will 
cause runtime errors in browsers that don't support this API, breaking the logo 
display functionality. The fix addresses this by replacing `URL.canParse()` 
with a more compatible try-catch approach using the URL constructor.
   </div>
   <details>
   <summary>
   <b>Code suggestion</b>
   </summary>
   <blockquote>Check the AI-generated fix before applying</blockquote>
   <div id="code">
   
   
   ```
    -export function assetUrlIf(url_or_path: string): string {
    -  if (URL.canParse(url_or_path)) return url_or_path;
    -
    -  return assetUrl(url_or_path);
    +export function assetUrlIf(url_or_path: string): string {
    +  try {
    +    new URL(url_or_path);
    +    return url_or_path;
    +  } catch {
    +    return assetUrl(url_or_path);
    +  }
    +}
   ```
   
   </div>
   </details>
   </div>
   
   
   
   <small><i>Code Review Run <a 
href=https://github.com/apache/superset/pull/34935#issuecomment-3266873604>#495b24</a></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