codeant-ai-for-open-source[bot] commented on code in PR #44665:
URL: https://github.com/apache/superset/pull/44665#discussion_r4108305756
##########
superset-frontend/plugins/plugin-chart-table/src/TableChart.tsx:
##########
@@ -496,9 +512,14 @@ export default function TableChart<D extends DataRecord =
DataRecord>(
}, [data.length, rowCount, serverPagination, serverPageLength]);
const getValueRange = useCallback(
- function getValueRange(key: string, alignPositiveNegative: boolean) {
+ function getValueRange(
+ key: string,
+ alignPositiveNegative: boolean,
+ coerceNumeric = false,
+ ) {
const nums = data
?.map(row => row?.[key])
+ .map(value => (coerceNumeric ? parseNumeric(value) : value))
Review Comment:
**Suggestion:** With only the global bar toggle enabled, numeric-looking
string rows are rendered using parsed values but the range still excludes them,
causing incorrect widths and offsets for mixed numeric columns.
**Assessment:** ๐ `Major` ยท ๐ `Occurrence: Sometimes` ยท ๐ท๏ธ `Logic error`
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=30bd95f5ff884d99b2017acf4481f015&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=30bd95f5ff884d99b2017acf4481f015&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-table/src/TableChart.tsx
**Line:** 522:522
**Comment:**
*Logic Error: With only the global bar toggle enabled, numeric-looking
string rows are rendered using parsed values but the range still excludes them,
causing incorrect widths and offsets for mixed numeric columns.
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%2F44665&comment_hash=2d7603edd1a71d478a20618d4ecf76a929ac9a883c700bebceb7651a1aaeb512&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F44665&comment_hash=2d7603edd1a71d478a20618d4ecf76a929ac9a883c700bebceb7651a1aaeb512&reaction=dislike'>๐</a>
##########
superset-frontend/plugins/plugin-chart-table/src/TableChart.tsx:
##########
@@ -1195,29 +1244,38 @@ export default function TableChart<D extends DataRecord
= DataRecord>(
top: 0;
${
valueRange &&
- typeof value === 'number' &&
+ numericValue !== undefined &&
valueRangeFlag &&
`
width: ${`${cellWidth({
- value: value as number,
+ value: numericValue,
valueRange,
alignPositiveNegative,
})}%`};
left: ${`${cellOffset({
- value: value as number,
+ value: numericValue,
valueRange,
alignPositiveNegative,
})}%`};
background-color: ${
backgroundColorCellBar ||
cellBackground({
- value: value as number,
+ value: numericValue,
colorPositiveNegative,
theme,
})
};
`
}
+ ${
+ !(valueRange && numericValue !== undefined && valueRangeFlag) &&
+ backgroundColorCellBar &&
+ `
+ width: 100%;
+ left: 0;
+ background-color: ${backgroundColorCellBar};
+ `
Review Comment:
**Suggestion:** A matching cell-bar rule on a nonnumeric string or boolean
has no geometry, but this fallback paints the entire cell with a full-width bar.
**Assessment:** ๐ `Major` ยท ๐ `Occurrence: Sometimes` ยท ๐ท๏ธ `Logic error`
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=5dec720382254bf1bcbd546259ab0ffd&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=5dec720382254bf1bcbd546259ab0ffd&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-table/src/TableChart.tsx
**Line:** 1271:1277
**Comment:**
*Logic Error: A matching cell-bar rule on a nonnumeric string or
boolean has no geometry, but this fallback paints the entire cell with a
full-width bar.
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%2F44665&comment_hash=1e8b9febfb1fe211d935dd91d68c57f6b6662385337de735cca8755bab7103fb&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F44665&comment_hash=1e8b9febfb1fe211d935dd91d68c57f6b6662385337de735cca8755bab7103fb&reaction=dislike'>๐</a>
##########
superset-frontend/plugins/plugin-chart-table/src/TableChart.tsx:
##########
@@ -1140,6 +1176,19 @@ export default function TableChart<D extends DataRecord
= DataRecord>(
} else {
valueToFormat = value;
}
+ // String cells that read as numbers ("1.00") must compare
+ // numerically, or comparator rules like `= 1` never match.
+ if (
+ formatter.objectFormatting ===
+ ObjectFormattingEnum.CELL_BAR &&
+ valueToFormat !== null &&
+ valueToFormat !== undefined
+ ) {
+ const coerced = parseNumeric(valueToFormat);
+ if (coerced !== undefined) {
+ valueToFormat = coerced;
+ }
+ }
Review Comment:
**Suggestion:** Coercing every cell-bar formatter value changes
numeric-looking strings into numbers before string comparators run, so
`BeginsWith`, `EndsWith`, and `Containing` rules stop matching.
**Assessment:** ๐ `Major` ยท ๐ `Occurrence: Sometimes` ยท ๐ท๏ธ `Api mismatch`
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=0a25578a4ef74c3eadc5e2b35a2e1ae3&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=0a25578a4ef74c3eadc5e2b35a2e1ae3&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-table/src/TableChart.tsx
**Line:** 1181:1191
**Comment:**
*Api Mismatch: Coercing every cell-bar formatter value changes
numeric-looking strings into numbers before string comparators run, so
`BeginsWith`, `EndsWith`, and `Containing` rules stop matching.
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%2F44665&comment_hash=d51c904e74473030d5ba271033c209b3209f9df0307148f7e6d3f3ccf8ed9272&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F44665&comment_hash=d51c904e74473030d5ba271033c209b3209f9df0307148f7e6d3f3ccf8ed9272&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]