diegomedina248 commented on code in PR #19939:
URL: https://github.com/apache/superset/pull/19939#discussion_r865320778
##########
superset-frontend/src/components/AlteredSliceTag/index.jsx:
##########
@@ -147,15 +147,12 @@ export default class AlteredSliceTag extends
React.Component {
if (controlsMap[key]?.type === 'CollectionControl') {
return value.map(v => safeStringify(v)).join(', ');
}
- if (controlsMap[key]?.type === 'MetricsControl' && Array.isArray(value)) {
- const formattedValue = value.map(v => (v.label ? v.label : v));
- return formattedValue.length ? formattedValue.join(', ') : '[]';
- }
if (typeof value === 'boolean') {
return value ? 'true' : 'false';
}
if (value.constructor === Array) {
- return value.length ? value.join(', ') : '[]';
+ const formattedValue = value.map(v => (v.label ? v.label : v));
Review Comment:
This could potentially be called for other control types aside from metrics.
Why did you move it from above? Was the code not entering? We're essentially
switching from `Array.isArray` to `value.constructor`, which should have
similar effect.
If that's the only reason, we could replace `Array.isArray` with
`value.constructor` in the other block you removed, but keeping it locked to
the metrics control.
--
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]