shubhamraj-git commented on code in PR #45790:
URL: https://github.com/apache/airflow/pull/45790#discussion_r1929221510
##########
airflow/ui/src/components/FlexibleForm/FieldStringArray.tsx:
##########
@@ -19,15 +19,32 @@
import { Textarea } from "@chakra-ui/react";
import type { FlexibleFormElementProps } from ".";
+import { paramPlaceholder, useParamStore } from "../TriggerDag/useParamStore";
-export const FieldStringArray = ({ name, param }: FlexibleFormElementProps) =>
(
- <Textarea
- defaultValue={
- Array.isArray(param.value) ? (param.value as Array<string>).join("\n") :
String(param.value ?? "")
+export const FieldStringArray = ({ name }: FlexibleFormElementProps) => {
+ const { paramsDict, setParamsDict } = useParamStore();
+ const param = paramsDict[name] ?? paramPlaceholder;
+ const handleChange = (newValue: string) => {
+ const newValueArray = newValue.split("\n");
+
+ if (paramsDict[name]) {
+ paramsDict[name].value = newValueArray;
Review Comment:
I kept it `[]`, having `null` changes the param UI for that field to
different state. And I see no harm having it as []. Let me know if there could
be case which might be problematic.
--
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]