korbit-ai[bot] commented on code in PR #34758:
URL: https://github.com/apache/superset/pull/34758#discussion_r2285664783


##########
superset-frontend/src/pages/SavedQueryList/index.tsx:
##########
@@ -229,6 +230,15 @@ function SavedQueryList({
 
   // Action methods
   const openInSqlLab = (id: number, openInNewWindow: boolean) => {
+    copyTextToClipboard(() =>
+      Promise.resolve(`${window.location.origin}/sqllab?savedQueryId=${id}`),
+    )

Review Comment:
   ### URL Mismatch Between Clipboard and Redirection <sub>![category 
Functionality](https://img.shields.io/badge/Functionality-0284c7)</sub>
   
   <details>
     <summary>Tell me more</summary>
   
   ###### What is the issue?
   The URL being copied using copyTextToClipboard does not match the URL being 
opened. The copied URL includes window.location.origin while the opened URL 
does not.
   
   
   ###### Why this matters
   Users will get a different URL in their clipboard than the one they are 
redirected to, which could lead to broken links when sharing.
   
   ###### Suggested change ∙ *Feature Preview*
   Ensure both URLs use the same format:
   ```typescript
   const sqlLabUrl = `/sqllab?savedQueryId=${id}`;
   copyTextToClipboard(() =>
     Promise.resolve(`${window.location.origin}${sqlLabUrl}`),
   )
     .then(() => {
       addSuccessToast(t('Link Copied!'));
     })
     .catch(() => {
       addDangerToast(t('Sorry, your browser does not support copying.'));
     });
   if (openInNewWindow) {
     window.open(sqlLabUrl);
   } else {
     history.push(sqlLabUrl);
   }
   ```
   
   
   ###### Provide feedback to improve future suggestions
   [![Nice 
Catch](https://img.shields.io/badge/👍%20Nice%20Catch-71BC78)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/275dee11-e9a1-4466-aa21-3f291e665fe3/upvote)
 
[![Incorrect](https://img.shields.io/badge/👎%20Incorrect-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/275dee11-e9a1-4466-aa21-3f291e665fe3?what_not_true=true)
  [![Not in 
Scope](https://img.shields.io/badge/👎%20Out%20of%20PR%20scope-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/275dee11-e9a1-4466-aa21-3f291e665fe3?what_out_of_scope=true)
 [![Not in coding 
standard](https://img.shields.io/badge/👎%20Not%20in%20our%20standards-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/275dee11-e9a1-4466-aa21-3f291e665fe3?what_not_in_standard=true)
 
[![Other](https://img.shields.io/badge/👎%20Other-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/275dee11-e9a1-4466-aa21-3f291e665fe3)
   </details>
   
   <sub>
   
   💬 Looking for more details? Reply to this comment to chat with Korbit.
   </sub>
   
   <!--- korbi internal id:891e5f89-fb44-4905-8262-6ce32538c8e7 -->
   
   
   [](891e5f89-fb44-4905-8262-6ce32538c8e7)



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