codeant-ai-for-open-source[bot] commented on code in PR #42880:
URL: https://github.com/apache/superset/pull/42880#discussion_r3737546804
##########
superset-frontend/plugins/plugin-chart-echarts/src/Pie/transformProps.ts:
##########
@@ -296,6 +300,9 @@ export default function transformProps(
currencyCodeColumn,
detectedCurrency,
);
+ const percentFormatter = numberFormat.endsWith('%')
+ ? getNumberFormatter(numberFormat)
+ : defaultPercentFormatter;
Review Comment:
**Suggestion:** Calling `endsWith` directly on `numberFormat` can throw when
an older or partially populated chart payload explicitly provides
`number_format: undefined` (or `null`). The merged form data then overwrites
`DEFAULT_PIE_FORM_DATA`, while `getValueFormatter` already accepts an absent
format. Guard the value before checking its suffix so such charts continue to
render. [null pointer]
<details>
<summary><b>Severity Level:</b> Major ⚠️</summary>
```mdx
- ❌ Legacy pie charts with null formats fail transformation.
- ❌ Pie labels and tooltips do not render.
- ⚠️ Dashboard hydration preserves malformed form values.
```
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=8a7ff55f03d44ebd8f9ba73a48c747a7&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=8a7ff55f03d44ebd8f9ba73a48c747a7&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
*(Use Cmd/Ctrl + Click for best experience)*
<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:** 303:305
**Comment:**
*Null Pointer: Calling `endsWith` directly on `numberFormat` can throw
when an older or partially populated chart payload explicitly provides
`number_format: undefined` (or `null`). The merged form data then overwrites
`DEFAULT_PIE_FORM_DATA`, while `getValueFormatter` already accepts an absent
format. Guard the value before checking its suffix so such charts continue to
render.
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%2F42880&comment_hash=20abada67cfb519cbbda425a2f1d91cf23a3b67d41948dfa2224a8563ea9dc5c&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F42880&comment_hash=20abada67cfb519cbbda425a2f1d91cf23a3b67d41948dfa2224a8563ea9dc5c&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]