schizophrenicmaniac opened a new pull request, #44963: URL: https://github.com/apache/superset/pull/44963
### SUMMARY The Run button in Explore is disabled while any control has validation errors, and it turns into a Stop button while the chart is loading. The Ctrl/Cmd+Enter shortcut called `onQuery()` directly and skipped both checks, so it could trigger a query (and push a history entry) with an invalid control panel, or fire a second query while one was still running. `handleKeydown` now applies the same rules as the button. It returns without querying if any control has non-empty `validationErrors` (the same condition behind `errorMessage`), or if `chart.chartStatus` is `loading`. I check the controls directly rather than reading `errorMessage`, because that memo is defined further down the component, after the keydown handler and its effect. I added RTL tests to ExploreViewContainer.test.tsx: Ctrl+Enter and Cmd+Enter still run the query when controls are valid, and the shortcut does nothing when a control has validation errors or while the chart is loading. ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF No visual change. The only difference is that the keyboard shortcut no longer runs a query in these cases. A before/after recording is still to be added. ### TESTING INSTRUCTIONS 1. Open a chart in Explore and clear a required control (e.g. remove all metrics) so the Run/Update chart button is disabled with an error tooltip. 2. Click somewhere on the page outside an input and press Ctrl+Enter (Cmd+Enter on macOS). No query should run and the URL/history shouldn't change. 3. Fix the control and press Ctrl/Cmd+Enter again. The query should run. 4. Start a slow query and press Ctrl/Cmd+Enter while it's loading. No second query should start. 5. `npm run test -- src/explore/components/ExploreViewContainer/ExploreViewContainer.test.tsx` ### ADDITIONAL INFORMATION - [x] Has associated issue: Fixes #44914 - [ ] Required feature flags: - [ ] Changes UI - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351)) - [ ] Migration is atomic, supports rollback & is backwards-compatible - [ ] Confirm DB migration upgrade and downgrade tested - [ ] Runtime estimates and downtime expectations provided - [ ] Introduces new feature or API - [ ] Removes existing feature or API -- 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]
