bito-code-review[bot] commented on code in PR #38522:
URL: https://github.com/apache/superset/pull/38522#discussion_r2906696155
##########
superset-frontend/plugins/plugin-chart-echarts/src/Heatmap/transformProps.ts:
##########
@@ -370,20 +370,32 @@ export default function transformProps(
metricLabel,
);
const paramsValue = params.value as (string | number)[];
- const x = paramsValue?.[0];
- const y = paramsValue?.[1];
+ // paramsValue contains [xIndex, yIndex, metricValue, rankValue?]
+ // We need to look up the actual axis values from the sorted arrays
+ const xIndex = paramsValue?.[0] as number;
+ const yIndex = paramsValue?.[1] as number;
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Fix index type conversion</b></div>
<div id="fix">
The type assertion 'as number' doesn't perform runtime conversion. If
params.value[0] is a string (e.g., '1'), xIndex remains a string, causing
sortedXAxisValues['1'] to be undefined instead of sortedXAxisValues[1]. This
could lead to empty axis labels and NaN percentages in tooltips. Use Number()
for proper conversion.
</div>
<details>
<summary>
<b>Code suggestion</b>
</summary>
<blockquote>Check the AI-generated fix before applying</blockquote>
<div id="code">
````suggestion
const xIndex = Number(paramsValue?.[0]);
const yIndex = Number(paramsValue?.[1]);
````
</div>
</details>
</div>
<small><i>Code Review Run #746e1e</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]