EnxDev commented on code in PR #37625:
URL: https://github.com/apache/superset/pull/37625#discussion_r2764398000
##########
superset-frontend/plugins/legacy-plugin-chart-horizon/src/HorizonChart.tsx:
##########
@@ -113,7 +118,7 @@ class HorizonChart extends PureComponent {
>
{data.map(row => (
<HorizonRow
- key={row.key}
+ key={row.key as unknown as string}
Review Comment:
Is the double cast intended to handle nullability, or is it implicitly
coercing an array to a string?
##########
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:
This probably had the same issue before, but should we validate
`clusterLabel` as a `number` at runtime rather than casting?
A silent `NaN` here means clusters disappear from the map without any
indication to the user.
##########
superset-frontend/plugins/legacy-plugin-chart-map-box/src/MapBox.tsx:
##########
@@ -109,15 +132,15 @@ class MapBox extends Component {
// to an area outside of the original bounds, no additional queries are
made to the backend to
// retrieve additional data.
// add this variable to widen the visible area
- const offsetHorizontal = (width * 0.5) / 100;
- const offsetVertical = (height * 0.5) / 100;
+ const offsetHorizontal = ((width ?? 400) * 0.5) / 100;
+ const offsetVertical = ((height ?? 400) * 0.5) / 100;
const bbox = [
- bounds[0][0] - offsetHorizontal,
- bounds[0][1] - offsetVertical,
- bounds[1][0] + offsetHorizontal,
- bounds[1][1] + offsetVertical,
+ bounds![0][0] - offsetHorizontal,
+ bounds![0][1] - offsetVertical,
+ bounds![1][0] + offsetHorizontal,
+ bounds![1][1] + offsetVertical,
Review Comment:
In the case of an empty dataset, what does transformProps return for bounds?
It may be safer to add a runtime guard or early return before the viewport
calculation rather than trusting the tuple shape.
--
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]