bito-code-review[bot] commented on code in PR #41170:
URL: https://github.com/apache/superset/pull/41170#discussion_r3471180184


##########
superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/components/RadioButtonControl.tsx:
##########
@@ -60,7 +60,7 @@ export default function RadioButtonControl({
   ...props
 }: RadioButtonControlProps) {
   const normalizedOptions = options.map(normalizeOption);
-  const currentValue = initialValue || normalizedOptions[0].value;
+  const currentValue = initialValue ?? normalizedOptions[0]?.value;

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Missing test coverage for edge cases</b></div>
   <div id="fix">
   
   The change from `||` to `??` correctly fixes a bug where falsy `JsonValue`s 
(0, false, empty string) would be incorrectly replaced with the first option. 
However, the test suite lacks coverage for: (1) empty `options` array edge 
case, and (2) falsy value handling for `value` prop. Consider adding tests to 
verify `currentValue` remains `undefined` when options are empty, and that 
falsy values like `0` or `false` are preserved rather than replaced.
   </div>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #5220ef</i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a 
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



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