msyavuz commented on code in PR #36890:
URL: https://github.com/apache/superset/pull/36890#discussion_r2658987485


##########
superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/transformUtils.ts:
##########
@@ -134,9 +134,27 @@ export function addPropertiesToFeature<T extends 
Record<string, unknown>>(
 }
 
 export function getMetricLabelFromFormData(
-  metric: string | { value?: string } | undefined,
+  metric:
+    | string
+    | { value?: string | number | object; type?: string }
+    | undefined,
 ): string | undefined {
   if (!metric) return undefined;
   if (typeof metric === 'string') return getMetricLabel(metric);
-  return metric.value ? getMetricLabel(metric.value) : undefined;
+  // Only return metric label if it's a metric type, not a fixed value
+  if (typeof metric === 'object' && metric.type === 'metric' && metric.value) {
+    if (typeof metric.value === 'string') {
+      return getMetricLabel(metric.value);
+    }
+    if (typeof metric.value === 'object' && metric.value) {
+      // Handle object metrics (adhoc or saved metrics)
+      const metricObj = metric.value as any;
+      const metricKey =
+        metricObj.label || metricObj.sqlExpression || metricObj.value;

Review Comment:
   Done, dried up the code a bunch



-- 
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]

Reply via email to