codeant-ai-for-open-source[bot] commented on code in PR #45336:
URL: https://github.com/apache/superset/pull/45336#discussion_r4282818884
##########
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:
✅ **CodeAnt verified this suggestion was addressed in subsequent commits and
marked this thread resolved** as of `b45e88f`.
The original keyboard action is retained across Enter/Space repeat events,
and repeated clicks use that action. `handleClick` returns when it differs from
the current action, preventing a repeat that began on Stop from running the
query.
<sub>If that's not right, unresolve this thread and CodeAnt will leave it
open.</sub>
<!-- codeant-auto-resolve-reply -->
--
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]