diff --git a/superset-frontend/src/components/AlteredSliceTag/index.jsx b/superset-frontend/src/components/AlteredSliceTag/index.jsx index 2faa62c8908db..dd5dfb3c87868 100644 --- a/superset-frontend/src/components/AlteredSliceTag/index.jsx +++ b/superset-frontend/src/components/AlteredSliceTag/index.jsx @@ -147,15 +147,19 @@ 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)); + if ( + controlsMap[key]?.type === 'MetricsControl' && + value.constructor === Array + ) { + const formattedValue = value.map(v => 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); + return formattedValue.length ? formattedValue.join(', ') : '[]'; } if (typeof value === 'string' || typeof value === 'number') { return value;