🐛 fix(EditFlowSettingsComponent): update flows array type to include description property to fix type error
🔧 chore(EditFlowSettingsComponent): refactor handleDescriptionChange to update description in flows array and setDesc state variable 🔧 chore(EditFlowSettingsComponent): update value prop of description textarea to use desc state variable instead of description prop
This commit is contained in:
parent
ff97f45a72
commit
f67c0ff509
1 changed files with 8 additions and 2 deletions
|
|
@ -7,7 +7,7 @@ type InputProps = {
|
||||||
name: string | null;
|
name: string | null;
|
||||||
description: string | null;
|
description: string | null;
|
||||||
maxLength?: number;
|
maxLength?: number;
|
||||||
flows: Array<{ id: string; name: string }>;
|
flows: Array<{ id: string; name: string; description: string }>;
|
||||||
tabId: string;
|
tabId: string;
|
||||||
setName: (name: string) => void;
|
setName: (name: string) => void;
|
||||||
setDescription: (description: string) => void;
|
setDescription: (description: string) => void;
|
||||||
|
|
@ -37,7 +37,13 @@ export const EditFlowSettings: React.FC<InputProps> = ({
|
||||||
setName(value);
|
setName(value);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const [desc, setDesc] = useState(
|
||||||
|
flows.find((f) => f.id === tabId).description
|
||||||
|
);
|
||||||
|
|
||||||
const handleDescriptionChange = (event: ChangeEvent<HTMLTextAreaElement>) => {
|
const handleDescriptionChange = (event: ChangeEvent<HTMLTextAreaElement>) => {
|
||||||
|
flows.find((f) => f.id === tabId).description = event.target.value;
|
||||||
|
setDesc(flows.find((f) => f.id === tabId).description)
|
||||||
setDescription(event.target.value);
|
setDescription(event.target.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -70,7 +76,7 @@ export const EditFlowSettings: React.FC<InputProps> = ({
|
||||||
name="description"
|
name="description"
|
||||||
id="description"
|
id="description"
|
||||||
onChange={handleDescriptionChange}
|
onChange={handleDescriptionChange}
|
||||||
value={description ?? ""}
|
value={desc}
|
||||||
placeholder="Flow description"
|
placeholder="Flow description"
|
||||||
className="mt-2 max-h-[100px] font-normal"
|
className="mt-2 max-h-[100px] font-normal"
|
||||||
rows={3}
|
rows={3}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue