♻️ (GenericNode/index.tsx): refactor showNode state initialization and update logic to use useState and useEffect hooks for better readability and maintainability
This commit is contained in:
parent
3baca9b89b
commit
bb7620b810
1 changed files with 4 additions and 2 deletions
|
|
@ -211,10 +211,12 @@ export default function GenericNode({
|
||||||
}
|
}
|
||||||
}, [validationStatus, validationStatus?.params]);
|
}, [validationStatus, validationStatus?.params]);
|
||||||
|
|
||||||
// const showNode = data.showNode ?? true;
|
|
||||||
|
|
||||||
const [showNode, setShowNode] = useState(data.showNode ?? true);
|
const [showNode, setShowNode] = useState(data.showNode ?? true);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setShowNode(data.showNode ?? true);
|
||||||
|
}, [data.showNode]);
|
||||||
|
|
||||||
const nameEditable = true;
|
const nameEditable = true;
|
||||||
|
|
||||||
const emojiRegex = /\p{Emoji}/u;
|
const emojiRegex = /\p{Emoji}/u;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue