🔥 refactor(codeAreaModal/index.tsx): simplify useEffect logic and add conditional check to prevent unnecessary handleClick execution

This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-07-18 15:29:29 -03:00
commit e0d086e85a

View file

@ -38,9 +38,14 @@ export default function CodeAreaModal({
detail: { error: string; traceback: string };
}>(null);
// useEffect(() => {
// handleClick();
// }, []);
useEffect(() => {
// if nodeClass.template has more fields other than code and dynamic is true
// do not run handleClick
if (dynamic && Object.keys(nodeClass.template).length > 1) {
return;
}
handleClick();
}, []);
function handleClick() {
if (!dynamic) {