rusackas commented on code in PR #37625:
URL: https://github.com/apache/superset/pull/37625#discussion_r2765528982


##########
superset-frontend/plugins/legacy-plugin-chart-map-box/src/ScatterPlotGlowOverlay.tsx:
##########
@@ -186,7 +235,7 @@ class ScatterPlotGlowOverlay extends PureComponent {
           if (location.properties.cluster) {
             let clusterLabel = clusterLabelMap[i];
             const scaledRadius = roundDecimal(
-              (clusterLabel / maxLabel) ** 0.5 * radius,
+              ((clusterLabel as number) / safeMaxLabel) ** 0.5 * radius,

Review Comment:
   You're right that casting without validation could produce silent NaN 
values. I've added proper runtime validation:
   
   ```
     const numericLabel = Number(clusterLabel);
     const safeNumericLabel = Number.isFinite(numericLabel) ? numericLabel : 0;
     const scaledRadius = roundDecimal(
       (safeNumericLabel / safeMaxLabel) ** 0.5 * radius,
       1,
     );
   ```
   
   Now if clusterLabel is a non-numeric string or NaN, it falls back to 0, 
which will render as a zero-radius point (essentially invisible but won't 
crash). The existing check on line 270 
(`Number.isFinite(parseFloat(String(clusterLabel)))`) will also skip drawing 
the label text for these cases.
   



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