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


##########
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:
   <!-- Bito Reply -->
   The suggestion to add test coverage for edge cases is appropriate and 
improves the robustness of the code. Specifically, verifying how the component 
handles an empty `options` array and ensuring that falsy values (like `0` or 
`false`) are correctly preserved is a good practice when switching from the 
logical OR (`||`) operator to the nullish coalescing (`??`) operator.



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