Fixed variable names

This commit is contained in:
Lucas Oliveira 2023-08-11 12:09:00 -03:00
commit c37e1223fc

View file

@ -18,14 +18,14 @@ type InputProps = {
}; };
export const EditFlowSettings: React.FC<InputProps> = ({ export const EditFlowSettings: React.FC<InputProps> = ({
name: myName, name,
invalidName, invalidName,
setInvalidName, setInvalidName,
description, description,
maxLength = 50, maxLength = 50,
flows, flows,
tabId, tabId,
setName: setMyName, setName,
setDescription, setDescription,
updateFlow, updateFlow,
}) => { }) => {
@ -54,21 +54,21 @@ export const EditFlowSettings: React.FC<InputProps> = ({
} }
} }
setName(value); setName(value);
setMyName(value); setCurrentName(value);
}; };
const [name, setName] = useState(myName); const [currentName, setCurrentName] = useState(name);
const [desc, setDesc] = useState(description); const [currentDescription, setCurrentDescription] = useState(description);
useEffect(() => { useEffect(() => {
setName(name); setCurrentName(name);
setDesc(description); setCurrentDescription(description);
}, [name, description]); }, [name, description]);
const handleDescriptionChange = (event: ChangeEvent<HTMLTextAreaElement>) => { const handleDescriptionChange = (event: ChangeEvent<HTMLTextAreaElement>) => {
flows.find((f) => f.id === tabId).description = event.target.value; flows.find((f) => f.id === tabId).description = event.target.value;
setDesc(flows.find((f) => f.id === tabId).description); setCurrentDescription(flows.find((f) => f.id === tabId).description);
setDescription(event.target.value); setDescription(event.target.value);
}; };
@ -89,7 +89,7 @@ export const EditFlowSettings: React.FC<InputProps> = ({
onChange={handleNameChange} onChange={handleNameChange}
type="text" type="text"
name="name" name="name"
value={name ?? ""} value={currentName ?? ""}
placeholder="File name" placeholder="File name"
id="name" id="name"
maxLength={maxLength} maxLength={maxLength}
@ -104,7 +104,7 @@ export const EditFlowSettings: React.FC<InputProps> = ({
name="description" name="description"
id="description" id="description"
onChange={handleDescriptionChange} onChange={handleDescriptionChange}
value={desc} value={currentDescription}
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}