Subham-KRLX opened a new pull request, #62060:
URL: https://github.com/apache/airflow/pull/62060

   This PR fixes a regression where the Trigger UI form crashes if a 
parameter's enum contains `null` (used to make fields optional).
   
   The `zag-js` library (used by Chakra UI's Select component) requires string 
values for dropdown items. When `null` is passed in an enum, it causes a crash 
with `[zag-js] No value found for item {"label":null,"value":null}`.
   
   This fix:
   1.  In 
[FieldDropdown.tsx](cci:7://file:///Users/subhamsangwan/airflow/airflow-core/src/airflow/ui/src/components/FlexibleForm/FieldDropdown.tsx:0:0-0:0),
 `null` enum values are converted to the string `"null"` specifically for the 
UI rendering.
   2.  When the value changes, the string `"null"` is converted back to the 
actual `null` primitive in the form state.
   3.  
[labelLookup](cci:1://file:///Users/subhamsangwan/airflow/airflow-core/src/airflow/ui/src/components/FlexibleForm/FieldDropdown.tsx:27:0-36:2)
 is updated to safely handle `null` keys.
   
   I've added comprehensive unit tests in 
[FieldDropdown.test.tsx](cci:7://file:///Users/subhamsangwan/airflow/airflow-core/src/airflow/ui/src/components/FlexibleForm/FieldDropdown.test.tsx:0:0-0:0)
 covering:
   *   Rendering mixed enums with `null`
   *   Custom labels for `null` via `values_display`
   *   Clearing selections
   *   Form submission correctness
   
   closes: #62049
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes (please specify the tool below)


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

Reply via email to