You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "sadpandajoe (via GitHub)" <gi...@apache.org> on 2026/10/02 21:49:10 UTC

[I] RadioButtonControl calls onChange twice per selection (Radio.Group onChange plus a per-button onClick) [superset]

sadpandajoe opened a new issue, #44921:
URL: https://github.com/apache/superset/issues/44921

   
   ### Bug description
   
   `RadioButtonControl` wires the change in two places: `Radio.Group onChange` and an `onClick` on every `Radio.Button`. Selecting a different option fires both, so `onChange` runs at least twice with the same value (the click can also reach the handler via both the label and the inner input). Clicking the already-selected button also fires `onChange` through `onClick` even though nothing changed. Controls that dispatch on change (control panel, ColumnConfig form items, MapView/ZoomConfig mode switches) therefore dispatch duplicate updates.
   
   Steps to reproduce: render `RadioButtonControl` with an `onChange` spy and click an unselected option: the spy is called more than once. Click the selected option: the spy is still called.
   
   Expected: one call per actual change.
   
   ### Where
   
   `superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/components/RadioButtonControl.tsx`
   - L72-L75 `<Radio.Group value={currentValue} onChange={e => onChange(e.target.value)}>`
   - L96-L99 `onClick={e => { e.currentTarget?.focus(); onChange(val); }}`
   
   (`VerticalRadioControl.tsx` only uses the Group `onChange`, so it is not affected.)
   
   ### Suggested fix
   
   Keep only the `Radio.Group onChange`; move the `focus()` call into a click handler that does not call `onChange`.
   
   ### 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: notifications-unsubscribe@superset.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] RadioButtonControl calls onChange twice per selection (Radio.Group onChange plus a per-button onClick) [superset]

Posted by "sadpandajoe (via GitHub)" <gi...@apache.org>.
sadpandajoe closed issue #44921: RadioButtonControl calls onChange twice per selection (Radio.Group onChange plus a per-button onClick)
URL: https://github.com/apache/superset/issues/44921


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org