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


##########
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:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Redundant boolean prop with divergence risk</b></div>
   <div id="fix">
   
   The `useCustomColorRange` boolean prop carries zero semantic weight — its 
value is always derived deterministically from 
`Number.isFinite(colorRangeStart) && Number.isFinite(colorRangeEnd)` upstream 
in `transformProps.ts` (line 48). Passing it as a prop duplicates that logic 
and creates a divergence risk: if `transformProps` is updated without updating 
`Calendar.ts`, the two branches will disagree. Drop the prop and inline 
`Number.isFinite(colorRangeStart) && Number.isFinite(colorRangeEnd)` as the 
condition in line 107.
   </div>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #ff39c6</i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a 
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



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