bito-code-review[bot] commented on code in PR #44963:
URL: https://github.com/apache/superset/pull/44963#discussion_r4176848525
##########
superset-frontend/src/explore/components/ExploreViewContainer/index.tsx:
##########
@@ -580,14 +580,21 @@ function ExploreViewContainer(props:
ExploreViewContainerProps) {
const controlOrCommand = event.ctrlKey || event.metaKey;
if (controlOrCommand) {
const isEnter = event.key === 'Enter' || event.keyCode === 13;
- if (isEnter) {
+ // Match the Run button, which is disabled while any control has
+ // validation errors and swapped for Stop while the chart is loading
+ const hasValidationErrors = Object.values(props.controls).some(
+ control =>
+ control.validationErrors && control.validationErrors.length > 0,
+ );
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Duplicated validation check</b></div>
<div id="fix">
The `hasValidationErrors` predicate (585-588) duplicates the identical
`Object.values(props.controls).some(...)` check already at 649-652 and 909-912,
plus the matrixify-excluding variant at 953-958. If validation semantics
change, all copies must stay in sync. Extract a shared helper and reuse it here
and in the mount effect.
</div>
</div>
<small><i>Code Review Run #0e0284</i></small>
</div>
---
Should Bito avoid suggestions like this for future reviews? (<a
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
- [ ] Yes, avoid them
--
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]