bito-code-review[bot] commented on code in PR #44668:
URL: https://github.com/apache/superset/pull/44668#discussion_r4134516253
##########
superset-frontend/src/explore/components/controls/ColumnConfigControl/ColumnConfigPopover.tsx:
##########
@@ -79,7 +79,17 @@ export default function ColumnConfigPopover({
key: i.toString(),
label: item.tab,
children: (
- <ControlForm onChange={onChange} value={column.config}>
+ <ControlForm
+ onChange={onChange}
+ onReset={name =>
+ onChange(
+ Object.fromEntries(
+ Object.entries(column.config).filter(([key]) => key !==
name),
+ ),
+ )
+ }
Review Comment:
<!-- Bito Reply -->
Moving the key-deletion logic into `ControlForm` is a sound architectural
improvement. It centralizes the reset semantics, reduces code duplication
across call sites, and ensures consistent behavior, which aligns with the
reviewer's goal of preventing divergence in reset logic. Since `ControlForm`
already manages the `onChange` callback and the `value` state, it is
well-positioned to handle the key removal internally.
**superset-frontend/src/explore/components/controls/ColumnConfigControl/ColumnConfigPopover.tsx**
```
<ControlForm
onChange={onChange}
onReset={name => {
const { [name]: _, ...rest } = column.config;
onChange(rest);
}}
/>
```
--
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]