bito-code-review[bot] commented on PR #42115:
URL: https://github.com/apache/superset/pull/42115#issuecomment-5000148227
<!-- Bito Reply -->
The flagged issue is correct. The current merge logic creates sparse objects
where missing keys for metrics without Green/Red rules result in `undefined`
values, which then overwrite existing background colors in the AG Grid
renderer. To resolve this, you should ensure the merge preserves existing
values or only includes entries for columns that have active rules.
Here is a concise fix for the merge logic in
`superset-frontend/plugins/plugin-chart-ag-grid-table/src/transformProps.ts`:
```typescript
const basicColorFormatters = (baseQuery?.data ?? []).map((_row, index) => {
const comparison = (comparisonColorFormatters || [])[index] || {};
const basic = (basicColorColumnFormatters || [])[index] || {};
return { ...comparison, ...basic };
});
```
This approach ensures that the resulting object is a clean merge of the two
formatters without introducing `undefined` overwrites for missing keys. I have
not checked other comments on this PR as you requested to implement this fix
first. Would you like me to fetch and validate the remaining comments to
address them as well?
**superset-frontend/plugins/plugin-chart-ag-grid-table/src/transformProps.ts**
```
const basicColorFormatters = (baseQuery?.data ?? []).map((_row, index) => {
const comparison = (comparisonColorFormatters || [])[index] || {};
const basic = (basicColorColumnFormatters || [])[index] || {};
return { ...comparison, ...basic };
});
```
--
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]