bito-code-review[bot] commented on PR #37461:
URL: https://github.com/apache/superset/pull/37461#issuecomment-3806870684
<!-- Bito Reply -->
The review comment correctly identifies a runtime error: `label_map` is
optional, but `mapColumnsToLabels` destructures it without a default, leading
to `undefined` being passed to `getColumnLabel`, which calls `Object.entries()`
and throws. The suggested fixes—making `getColumnLabel` handle falsy `labelMap`
by returning `colname`, or adding a guard in `mapColumnsToLabels` to skip
mapping when `label_map` is missing—are valid and should prevent the crash for
legacy or omitted payloads.
**superset-frontend/src/components/Chart/DrillBy/DrillByModal.tsx**
```
const mapColumnsToLabels = useCallback(
(dataResult: QueryData[]) =>
dataResult.map(result => {
const { colnames, label_map: labelMap, data } = result;
let newColnames: string[] = colnames;
let newData: DataRecord[] = data;
colnames.forEach((colname: string) => {
const label = getColumnLabel(colname, labelMap);
// ... rest of the function
});
return { ...result, colnames: newColnames, data: newData };
}),
[getColumnLabel],
);
```
--
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]