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


##########
superset-frontend/src/pages/SavedQueryList/index.tsx:
##########
@@ -231,6 +232,21 @@ function SavedQueryList({
     }
   };
 
+  const copySavedQueryLink = useCallback(
+    (id: number) => {
+      copyTextToClipboard(() =>
+        Promise.resolve(`${window.location.origin}/sqllab?savedQueryId=${id}`),
+      )

Review Comment:
   ### Unnecessary Promise for String Operation <sub>![category 
Performance](https://img.shields.io/badge/Performance-4f46e5)</sub>
   
   <details>
     <summary>Tell me more</summary>
   
   ###### What is the issue?
   Using Promise.resolve for a simple string concatenation is unnecessary 
overhead and adds complexity.
   
   
   ###### Why this matters
   Creating a Promise for a synchronous operation like string concatenation 
adds unnecessary overhead to the event loop and memory usage.
   
   ###### Suggested change ∙ *Feature Preview*
   Directly pass the string to copyTextToClipboard:
   ```typescript
   copyTextToClipboard(`${window.location.origin}/sqllab?savedQueryId=${id}`)
   ```
   
   
   ###### 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/cb326443-924f-45dc-a1d3-52dc3564d0dc/upvote)
 
[![Incorrect](https://img.shields.io/badge/👎%20Incorrect-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/cb326443-924f-45dc-a1d3-52dc3564d0dc?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/cb326443-924f-45dc-a1d3-52dc3564d0dc?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/cb326443-924f-45dc-a1d3-52dc3564d0dc?what_not_in_standard=true)
 
[![Other](https://img.shields.io/badge/👎%20Other-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/cb326443-924f-45dc-a1d3-52dc3564d0dc)
   </details>
   
   <sub>
   
   💬 Looking for more details? Reply to this comment to chat with Korbit.
   </sub>
   
   <!--- korbi internal id:a0bee238-1944-4d1e-a517-75f0ea9a7b99 -->
   
   
   [](a0bee238-1944-4d1e-a517-75f0ea9a7b99)



-- 
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: notifications-unsubscr...@superset.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org
For additional commands, e-mail: notifications-h...@superset.apache.org

Reply via email to