bito-code-review[bot] commented on code in PR #26230:
URL: https://github.com/apache/superset/pull/26230#discussion_r3615948150


##########
superset-frontend/plugins/legacy-plugin-chart-calendar/src/Calendar.ts:
##########
@@ -98,10 +104,12 @@ function Calendar(element: HTMLElement, props: 
CalendarProps) {
       calContainer.text(`${METRIC_TEXT}: ${verboseMap[metric] || metric}`);
     }
     const timestamps = metricsData[metric];
-    const rawExtents = d3Extent(
-      Object.keys(timestamps),
-      key => timestamps[key],
-    );
+    const rawExtents = useCustomColorRange
+      ? ([
+          Math.min(colorRangeStart as number, colorRangeEnd as number),
+          Math.max(colorRangeStart as number, colorRangeEnd as number),
+        ] as [number, number])
+      : d3Extent(Object.keys(timestamps), key => timestamps[key]);

Review Comment:
   <!-- Bito Reply -->
   The update correctly addresses the concern by removing the redundant boolean 
prop and deriving the condition inline. This change simplifies the component 
logic and eliminates the risk of divergence between the prop and the actual 
data state.
   
   **superset-frontend/plugins/legacy-plugin-chart-calendar/src/Calendar.ts**
   ```
   const timestamps = metricsData[metric];
       const rawExtents = (Number.isFinite(colorRangeStart) && 
Number.isFinite(colorRangeEnd))
         ? ([ 
             Math.min(colorRangeStart as number, colorRangeEnd as number),
             Math.max(colorRangeStart as number, colorRangeEnd as number),
           ] as [number, number])
         : d3Extent(Object.keys(timestamps), key => timestamps[key]);
   ```



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