SBIN2010 commented on code in PR #44955:
URL: https://github.com/apache/superset/pull/44955#discussion_r4187160318
##########
superset-frontend/packages/superset-ui-chart-controls/src/utils/headerGroups.ts:
##########
@@ -341,10 +344,18 @@ export function normalizeColumnConfigKeys<T>(
return {};
}
const colnamesSet = new Set(colnames);
+ const aliasToKey = new Map(
Review Comment:
This remap treats every saved key equal to the current `COLUMN_NAME_ALIASES`
label (`t('Time')`) as a legacy `__timestamp` entry.
That fires whenever `__timestamp` is in `colnames` and the saved key is not.
A real column or metric named `Time` (or the current translation) that has
dropped out of the result is then stored on `__timestamp` at the next edit.
Previously `normalizeColumnConfigKeys` kept unmatched keys.
The match is also only the string captured when `constants.ts` loads. The
`Main` migration accepts both the stable id and `t('Main')`. A chart saved
under a different translation of "Time" is left untouched, and
`setColumnConfig` still drops keys outside `colnames`, so that config is
deleted on the next edit.
Please remap only a key that is not a real column name, and accept both the
English source string and the current translation. Two tests would lock this:
`Time` stays put when it is not in `colnames` but `__timestamp` is, and an
alias saved in another locale still migrates.
##########
superset-frontend/src/explore/components/controls/ColumnConfigControl/ColumnConfigControl.tsx:
##########
Review Comment:
Normalization runs only inside this control. Table and AG Grid still read
`columnConfig[key]` with the query column name (`transformProps.ts`).
For a chart already saved as `column_config.Time`, reopening the popover
shows the migrated value from this in-memory copy, but the chart keeps looking
up `__timestamp` and the saved form data stays on `Time` until some edit calls
`onChange`.
Please apply the same key normalization where the chart reads
`column_config`, or write the remapped config back without requiring an
unrelated edit.
--
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]