codeant-ai-for-open-source[bot] commented on code in PR #37218:
URL: https://github.com/apache/superset/pull/37218#discussion_r2743224751


##########
superset-frontend/src/explore/controlUtils/getControlState.ts:
##########
@@ -122,7 +122,8 @@ export function applyMapStateToPropsToControl<T = 
ControlType>(
     }
   }
   // If no current value, set it as default
-  if (state.default && value === undefined) {
+  // Use loose equality to catch both null and undefined
+  if (state.default != null && value == null) {
     value = state.default;
   }
   // If a choice control went from multi=false to true, wrap value in array

Review Comment:
   **Suggestion:** Reinventing and duplicating array-wrapping logic: the code 
manually checks and wraps values for `multi` controls instead of using the 
existing `ensureIsArray` helper imported at the top; this can miss edge cases 
and is less clear. Replace the manual wrapping with `ensureIsArray` to 
consistently normalize to array when required. [code duplication]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ❌ Control normalization bugs for multi-choice controls.
   - ⚠️ Inconsistent value shapes across control initialization.
   - ⚠️ Tests relying on array normalization may fail intermittently.
   ```
   </details>
   
   



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