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></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
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/4ef3cb59-c515-4cf2-b312-ab1f948bbecc/upvote)
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/4ef3cb59-c515-4cf2-b312-ab1f948bbecc?what_not_true=true)
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/4ef3cb59-c515-4cf2-b312-ab1f948bbecc?what_out_of_scope=true)
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/4ef3cb59-c515-4cf2-b312-ab1f948bbecc?what_not_in_standard=true)
[](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]