🔥 refactor(codeAreaModal/index.tsx): simplify useEffect logic and add conditional check to prevent unnecessary handleClick execution
This commit is contained in:
parent
1f9e84d8c2
commit
e0d086e85a
1 changed files with 8 additions and 3 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue