devYRPauli commented on code in PR #74885:
URL: https://github.com/apache/airflow/pull/74885#discussion_r4490873715


##########
airflow-core/src/airflow/ui/src/components/FlexibleForm/FieldDropdown.tsx:
##########
@@ -58,6 +79,18 @@ export const FieldDropdown = ({ name, namespace = "default", 
onUpdate }: Flexibl
         ? (options.find((opt) => opt.value === String(param.value)) ?? null)
         : null;
 
+  // A parent change can leave the value outside the new options, so clear it
+  const isStale = dependsOn !== undefined && param.value !== null && 
currentValue === null;
+
+  useEffect(() => {
+    const current = paramsDict[name];
+
+    if (isStale && current) {
+      setParamsDict({ ...paramsDict, [name]: { ...current, value: null } });

Review Comment:
   No, that was not intended. The JSON editor drops `country` from the form 
store when the JSON omits it, so the dropdown found no options and cleared 
`city`. The backend fills an omitted parent with its default, so 
`{"city":"berlin"}` is valid there.
   
   The options now read the parent default when the parent is not in the form. 
The test `keeps the value when the JSON config omits the parent` fails without 
the change.



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