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


##########
superset-frontend/src/SqlLab/components/QueryLimitSelect/index.tsx:
##########
@@ -55,6 +56,17 @@ function renderQueryLimit(
           {convertToNumWithSpaces(limit)}{' '}
         </Menu.Item>
       ))}
+      <Input
+        type="number"
+        placeholder="custom limit"
+        onKeyDown={event => {
+          if (event.key === 'Enter') {
+            const limit = parseInt(event.target.value, 10);
+            setQueryLimit(limit);
+            convertToNumWithSpaces(limit);
+          }
+        }}

Review Comment:
   ### Missing NaN check in number parsing <sub>![category Error 
Handling](https://img.shields.io/badge/Error%20Handling-ea580c)</sub>
   
   <details>
     <summary>Tell me more</summary>
   
   ###### What is the issue?
   The parseInt() operation lacks handling for NaN results and the 
convertToNumWithSpaces call's result is unused.
   
   ###### Why this matters
   This could lead to setting invalid query limits if the input cannot be 
parsed as a number, potentially causing downstream issues in the SQL query 
execution.
   
   ###### Suggested change ∙ *Feature Preview*
   ```typescript
   onKeyDown={event => {
     if (event.key === 'Enter') {
       const limit = parseInt(event.target.value, 10);
       if (!Number.isNaN(limit) && limit > 0) {
         setQueryLimit(limit);
       }
     }
   }}
   ```
   
   
   ###### 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/4ef3cb59-c515-4cf2-b312-ab1f948bbecc/upvote)
 
[![Incorrect](https://img.shields.io/badge/👎%20Incorrect-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/4ef3cb59-c515-4cf2-b312-ab1f948bbecc?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/4ef3cb59-c515-4cf2-b312-ab1f948bbecc?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/4ef3cb59-c515-4cf2-b312-ab1f948bbecc?what_not_in_standard=true)
 
[![Other](https://img.shields.io/badge/👎%20Other-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/4ef3cb59-c515-4cf2-b312-ab1f948bbecc)
   </details>
   
   <sub>
   
   💬 Looking for more details? Reply to this comment to chat with Korbit.
   </sub>
   
   <!--- korbi internal id:ecc98228-6389-4d77-bc24-c6ba3ad85c9e -->
   
   
   [](ecc98228-6389-4d77-bc24-c6ba3ad85c9e)



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