bito-code-review[bot] commented on code in PR #42053:
URL: https://github.com/apache/superset/pull/42053#discussion_r3724587107
##########
superset-frontend/plugins/plugin-chart-pivot-table/src/react-pivottable/TableRenderers.tsx:
##########
@@ -202,7 +202,7 @@ export function getCellColor(
for (const formatter of cellColorFormatter) {
if (formatter.column === key) {
const result = formatter.getColorFromValue(aggValue);
- if (result) {
+ if (result && typeof result === 'string') {
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Unnecessary type guard</b></div>
<div id="fix">
The `typeof result === 'string'` guard is redundant. `getColorFromValue`
(line 509 in `types.ts`) is typed to return `string | undefined`, and
`getColorFunction` in `getColorFormatters.ts` confirms all code paths return
either a string or `undefined`. Adding this check creates inconsistency with
`TableChart.tsx` (line 1086) and `ag-grid-table/getCellStyle.ts` (line 68),
which use `if (result)` directly.
</div>
</div>
<small><i>Code Review Run #82aa23</i></small>
</div>
---
Should Bito avoid suggestions like this for future reviews? (<a
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
- [ ] Yes, avoid them
--
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]