From f67c0ff509c9ecc59fe4c6b364b1e7990847d529 Mon Sep 17 00:00:00 2001 From: Cristhian Zanforlin Lousa Date: Fri, 21 Jul 2023 11:09:35 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(EditFlowSettingsComponent):?= =?UTF-8?q?=20update=20flows=20array=20type=20to=20include=20description?= =?UTF-8?q?=20property=20to=20fix=20type=20error=20=F0=9F=94=A7=20chore(Ed?= =?UTF-8?q?itFlowSettingsComponent):=20refactor=20handleDescriptionChange?= =?UTF-8?q?=20to=20update=20description=20in=20flows=20array=20and=20setDe?= =?UTF-8?q?sc=20state=20variable=20=F0=9F=94=A7=20chore(EditFlowSettingsCo?= =?UTF-8?q?mponent):=20update=20value=20prop=20of=20description=20textarea?= =?UTF-8?q?=20to=20use=20desc=20state=20variable=20instead=20of=20descript?= =?UTF-8?q?ion=20prop?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/EditFlowSettingsComponent/index.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/frontend/src/components/EditFlowSettingsComponent/index.tsx b/src/frontend/src/components/EditFlowSettingsComponent/index.tsx index 390c3572e..06c2af949 100644 --- a/src/frontend/src/components/EditFlowSettingsComponent/index.tsx +++ b/src/frontend/src/components/EditFlowSettingsComponent/index.tsx @@ -7,7 +7,7 @@ type InputProps = { name: string | null; description: string | null; maxLength?: number; - flows: Array<{ id: string; name: string }>; + flows: Array<{ id: string; name: string; description: string }>; tabId: string; setName: (name: string) => void; setDescription: (description: string) => void; @@ -37,7 +37,13 @@ export const EditFlowSettings: React.FC = ({ setName(value); }; + const [desc, setDesc] = useState( + flows.find((f) => f.id === tabId).description + ); + const handleDescriptionChange = (event: ChangeEvent) => { + flows.find((f) => f.id === tabId).description = event.target.value; + setDesc(flows.find((f) => f.id === tabId).description) setDescription(event.target.value); }; @@ -70,7 +76,7 @@ export const EditFlowSettings: React.FC = ({ name="description" id="description" onChange={handleDescriptionChange} - value={description ?? ""} + value={desc} placeholder="Flow description" className="mt-2 max-h-[100px] font-normal" rows={3}