codeant-ai-for-open-source[bot] commented on code in PR #44562:
URL: https://github.com/apache/superset/pull/44562#discussion_r4079966549
##########
superset-frontend/plugins/plugin-chart-echarts/src/Pie/transformProps.ts:
##########
@@ -592,7 +599,10 @@ export default function transformProps(
legendOrientation,
showLegend,
theme,
+ false,
+ legendState,
),
+ scrollDataIndex: legendIndex || 0,
data: legendData,
Review Comment:
**Suggestion:** The saved legend page is reused after data changes, so fewer
categories can leave the pie legend positioned beyond its available entries.
**Assessment:** ๐ `Major` ยท ๐ `Occurrence: Sometimes` ยท ๐ท๏ธ `Stale reference`
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=384a6e7fc6564df0a31d3d35ba3a62a8&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=384a6e7fc6564df0a31d3d35ba3a62a8&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
<details>
<summary><b>Prompt for AI Agent ๐ค </b></summary>
```mdx
This is a comment left during a code review.
**Path:**
superset-frontend/plugins/plugin-chart-echarts/src/Pie/transformProps.ts
**Line:** 605:606
**Comment:**
*Stale Reference: The saved legend page is reused after data changes,
so fewer categories can leave the pie legend positioned beyond its available
entries.
Validate the correctness of the flagged issue. If correct, How can I resolve
this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask
user if the user wants to fix the rest of the comments as well. if said yes,
then fetch all the comments validate the correctness and implement a minimal fix
```
</details>
<a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F44562&comment_hash=4d134f5f829094a742cc2fd7e7e78eb0b444fe0496eb1938e7102c2d43762421&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F44562&comment_hash=4d134f5f829094a742cc2fd7e7e78eb0b444fe0496eb1938e7102c2d43762421&reaction=dislike'>๐</a>
##########
superset-frontend/plugins/plugin-chart-echarts/src/Gantt/EchartsGantt.tsx:
##########
@@ -44,23 +47,19 @@ export default function EchartsGantt(props:
EchartsGanttChartTransformedProps) {
setExtraHeight(updatedHeight);
}, [formData.showExtraControls]);
- const eventHandlers: EventHandlers = {
- legendselectchanged: payload => {
+ const deferLegendStateChange = useCallback(
+ (legendState: LegendState) => {
requestAnimationFrame(() => {
- onLegendStateChanged?.(payload.selected);
+ onLegendStateChanged?.(legendState);
});
Review Comment:
**Suggestion:** The animation frame is not cancellable, so after Gantt
unmounts or is replaced it can apply stale legend state to the parent chart
state.
**Assessment:** ๐ `Major` ยท ๐ `Occurrence: Rarely` ยท ๐ท๏ธ `Stale reference`
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=1f2ae5602d5e43658340f8891f350aca&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=1f2ae5602d5e43658340f8891f350aca&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
<details>
<summary><b>Prompt for AI Agent ๐ค </b></summary>
```mdx
This is a comment left during a code review.
**Path:**
superset-frontend/plugins/plugin-chart-echarts/src/Gantt/EchartsGantt.tsx
**Line:** 52:54
**Comment:**
*Stale Reference: The animation frame is not cancellable, so after
Gantt unmounts or is replaced it can apply stale legend state to the parent
chart state.
Validate the correctness of the flagged issue. If correct, How can I resolve
this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask
user if the user wants to fix the rest of the comments as well. if said yes,
then fetch all the comments validate the correctness and implement a minimal fix
```
</details>
<a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F44562&comment_hash=6562f972c8b03e73f271bbc77e4e6d82aeac5c7c541ca39b4b9ff19dba5cd94d&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F44562&comment_hash=6562f972c8b03e73f271bbc77e4e6d82aeac5c7c541ca39b4b9ff19dba5cd94d&reaction=dislike'>๐</a>
--
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]