From bb7620b810ae6deddab8f821bf3c52b5d8b6edbc Mon Sep 17 00:00:00 2001 From: cristhianzl Date: Fri, 29 Mar 2024 00:02:44 -0300 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20(GenericNode/index.tsx):?= =?UTF-8?q?=20refactor=20showNode=20state=20initialization=20and=20update?= =?UTF-8?q?=20logic=20to=20use=20useState=20and=20useEffect=20hooks=20for?= =?UTF-8?q?=20better=20readability=20and=20maintainability?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/frontend/src/CustomNodes/GenericNode/index.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/frontend/src/CustomNodes/GenericNode/index.tsx b/src/frontend/src/CustomNodes/GenericNode/index.tsx index 904a94b79..8eb8ca77c 100644 --- a/src/frontend/src/CustomNodes/GenericNode/index.tsx +++ b/src/frontend/src/CustomNodes/GenericNode/index.tsx @@ -211,10 +211,12 @@ export default function GenericNode({ } }, [validationStatus, validationStatus?.params]); - // const showNode = data.showNode ?? true; - const [showNode, setShowNode] = useState(data.showNode ?? true); + useEffect(() => { + setShowNode(data.showNode ?? true); + }, [data.showNode]); + const nameEditable = true; const emojiRegex = /\p{Emoji}/u;