codeant-ai-for-open-source[bot] commented on code in PR #45336:
URL: https://github.com/apache/superset/pull/45336#discussion_r4281944078
##########
superset-frontend/src/SqlLab/components/RunQueryActionButton/index.tsx:
##########
@@ -109,6 +118,32 @@ const RunQueryActionButton = ({
const shouldShowStopBtn =
!!queryState && ['running', 'pending'].indexOf(queryState) > -1;
+ const currentAction: ButtonAction = shouldShowStopBtn ? 'stop' : 'run';
+
+ // The label can switch between Stop and Run while a pointer or key is held
+ // down, and the browser dispatches the click against whatever the button
+ // shows at release time. Remember the action the gesture started on so a
+ // press that began on Stop can never run the query.
+ const gestureActionRef = useRef<ButtonAction | null>(null);
+
+ const captureGestureAction = () => {
+ gestureActionRef.current = currentAction;
+ };
+
+ const onKeyDownCapture = (event: KeyboardEvent<HTMLSpanElement>) => {
+ if (!event.repeat && (event.key === 'Enter' || event.key === ' ')) {
+ captureGestureAction();
+ }
Review Comment:
**Suggestion:** Enter key-repeat events are ignored here, but native buttons
can click on repeats; after the first Stop click, a repeat following query
completion can run the SQL.
**Assessment:** ๐ด `Critical` ยท ๐ `Occurrence: Rarely` ยท ๐ท๏ธ `Incorrect
condition logic`
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=b13d489ee94747cf97803eb7d9bd517b&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=b13d489ee94747cf97803eb7d9bd517b&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
<details>
<summary><b>Prompt for AI Agent ๐ค </b></summary>
```mdx
This is a comment left during a code review.
**Path:**
superset-frontend/src/SqlLab/components/RunQueryActionButton/index.tsx
**Line:** 134:136
**Comment:**
*Incorrect Condition Logic: Enter key-repeat events are ignored here,
but native buttons can click on repeats; after the first Stop click, a repeat
following query completion can run the SQL.
Validate the correctness of the flagged issue. If correct, How can I resolve
this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask
user if the user wants to fix the rest of the comments as well. if said yes,
then fetch all the comments validate the correctness and implement a minimal fix
```
</details>
<a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F45336&comment_hash=bae67aa6a22e440e4aeab105ff8945e5179fa71f02d2d25369eb41ce4141eb2c&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F45336&comment_hash=bae67aa6a22e440e4aeab105ff8945e5179fa71f02d2d25369eb41ce4141eb2c&reaction=dislike'>๐</a>
--
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]