bito-code-review[bot] commented on PR #42610:
URL: https://github.com/apache/superset/pull/42610#issuecomment-5128253143
<!-- Bito Reply -->
The flagged issue is correct. Using the spread operator (`...`) with
`Math.max` on a large array can exceed the maximum number of arguments allowed
by the JavaScript engine, leading to a `RangeError`. To resolve this, you
should replace the spread operator with a `reduce` function to calculate the
maximum value incrementally.
Here is the corrected implementation for the logic in
`superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts`:
```typescript
const stackedTotalMax = sortedTotalValues.reduce((max, v) => {
if (typeof v === 'number' && !Number.isNaN(v)) {
return Math.max(max, v);
}
return max;
}, -Infinity);
```
I have checked the available PR comments, and there are no other review
comments to address. Would you like me to proceed with any other tasks?
**superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts**
```
const stackedTotalMax = sortedTotalValues.reduce((max, v) => {
if (typeof v === 'number' && !Number.isNaN(v)) {
return Math.max(max, v);
}
return max;
}, -Infinity);
```
--
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]