sadpandajoe opened a new issue, #44914:
URL: https://github.com/apache/superset/issues/44914
### Bug description
The Run query button is disabled while any control has validation errors,
but the Ctrl/Cmd+Enter shortcut calls `onQuery()` directly with no such check,
so the query is triggered (and history updated) with an invalid control panel.
Steps to reproduce: open Explore, leave a required control empty or invalid
so the Run button is disabled with an error tooltip, focus the page and press
Ctrl/Cmd+Enter. The query is dispatched anyway.
Expected: the shortcut behaves like the Run button and is a no-op while
there are validation errors.
### Where
`superset-frontend/src/explore/components/ExploreViewContainer/index.tsx`
- L578-L591 `handleKeydown` -> `onQuery()` with no error check
- L900-L942 `errorMessage` (non-null when controls have errors) is what
disables the button: `RunQueryButton` `disabled={!!errorMessage}`
### Suggested fix
In `handleKeydown`, return early when `errorMessage` is set (add it to the
callback deps); optionally also when the chart is already loading.
### Found by
Found while adding React Testing Library coverage for Explore controls (all
line numbers are against `master` at `bc3698b5d6`).
--
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]