bito-code-review[bot] commented on PR #44562: URL: https://github.com/apache/superset/pull/44562#issuecomment-5790724689
<!-- Bito Reply --> The issue is valid. When the data changes, the `legendIndex` (which tracks the scroll position) may point to an index that no longer exists if the number of categories decreases, causing the legend to appear empty or incorrectly positioned. To resolve this, you should ensure the `scrollDataIndex` is clamped to the valid range of the new `legendData` length. In `superset-frontend/plugins/plugin-chart-echarts/src/Pie/transformProps.ts`, you can update the `scrollDataIndex` assignment: ```typescript scrollDataIndex: Math.min(legendIndex || 0, legendData.length - 1), ``` I have checked the other comments on this PR. There are no other actionable suggestions in the provided context. Would you like me to fetch all comments to validate and implement fixes for the rest of the PR? **superset-frontend/plugins/plugin-chart-echarts/src/Pie/transformProps.ts** ``` scrollDataIndex: Math.min(legendIndex || 0, legendData.length - 1), ``` -- 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]
