FrancescoCastaldi commented on PR #44945:
URL: https://github.com/apache/superset/pull/44945#issuecomment-6171972162

   ### PR Update: Preserved Re-click Gesture on Active RadioButtonControl Option
   
   Addressing review feedback from @sadpandajoe regarding `ZoomConfigControl` 
and Cartodiagram shape re-application:
   
   #### Changes Applied (Commit `8b13f79b`)
   1. **Separation of Transition vs Re-click**:
      - `Radio.Group.onChange` handles value transitions (`val !== 
currentValue`), firing exactly once and preventing duplicate emissions (#44921).
      - `Radio.Button.onClick` handles re-clicking the active option 
(`!disabled && val === currentValue`), firing `onChange(val)` once to preserve 
the rebuild gesture in `ZoomConfigControl` and state restoration in 
`ControlFormItem`.
   2. **Preemptive Simplification**:
      - Removed `isUnpersistedDefault` and `hasInitialValueProp` checks. The 
guard relies directly on `val === currentValue`, ensuring uniform behavior 
across undefined, null, and persisted states.
      - Added disabled option guard (`!disabled`).
   3. **Test Suite Alignment**:
      - Updated unit tests in `RadioButtonControl.test.tsx` to assert that 
re-clicking active options invokes `onChange` once, unpersisted defaults 
trigger correctly, and disabled buttons are protected.


-- 
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]

Reply via email to