sadpandajoe opened a new issue, #44911:
URL: https://github.com/apache/superset/issues/44911
### Bug description
`ColumnConfigControl` builds a display `name` for each column via
`COLUMN_NAME_ALIASES` (today only `__timestamp` -> "Time"). When the user edits
that column's settings, the config is written back using the display name as
the key, not the column key.
Result: the saved `column_config` gets a `"Time"` entry while the control
reads config back with `normalizedValue["__timestamp"]`, so the edit is not
reflected. On the next edit `setColumnConfig` also filters existing keys to the
real `colnames`, so the orphaned `"Time"` entry is dropped.
Expected: the config is stored under the real column key (`__timestamp`).
Steps to reproduce: open a chart whose results contain the `__timestamp`
column and a Customize/column config control (e.g. a table in a mode that
returns `__timestamp`), open the "Time" column's settings, change e.g. the
custom column name or visibility, and re-open the popover. The setting is not
retained under the real key.
### Where
`superset-frontend/src/explore/components/controls/ColumnConfigControl/ColumnConfigControl.tsx`
- L95: `name: COLUMN_NAME_ALIASES[col] || col,`
- L150: `onChange={config => setColumnConfig(col.name, config as T)}`
(`col.name` is the alias)
- L113-L122: `setColumnConfig` keeps only keys in `colnames`, then adds
`[col]: config`.
### Suggested fix
Keep the real key on `ColumnConfigInfo` (e.g. `key`/`colname`) and call
`setColumnConfig(col.key, ...)`; use the alias only for display
(`ColumnConfigItem` `title`/label and React `key`).
### Found by
Found while adding React Testing Library coverage for Explore controls (all
line numbers are against `master` at `bc3698b5d6`).
--
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]