michael-s-molina commented on code in PR #21351:
URL: https://github.com/apache/superset/pull/21351#discussion_r990007127
##########
superset-frontend/packages/superset-ui-core/src/chart/models/ChartMetadata.ts:
##########
@@ -49,6 +50,7 @@ export interface ChartMetadataConfig {
label?: ChartLabel | null;
labelExplanation?: string | null;
queryObjectCount?: number;
+ noAggregations?: (formData: QueryFormData) => boolean;
Review Comment:
Automatically detecting if we have aggregations is way better. Nice
suggestion @zhaoyongjie!
Considering that `metrics` is defined as `metrics?: QueryFormMetric[];` you
could use Lodash's `isEmpty` to improve readability. If we may have instances
that disrespect Typescript, we could also use `ensureIsArray`.
```
const { metrics } = extractQueryFields(formData);
if (isEmpty(metrics)) {
// logic for the noAggregations query.
}
```
--
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]