diff options
author | Sunil Shetye | 2023-02-15 16:36:14 +0530 |
---|---|---|
committer | Sunil Shetye | 2023-02-15 16:36:14 +0530 |
commit | 8d5f20f6d9548b06e3ef2701baef4fb132474120 (patch) | |
tree | 4e8ddfea15a06864d9787a76596345dbda6a1e93 | |
parent | fb823d7216d7e8ad20da3251fa297284bd1d4bec (diff) | |
download | Common-Interface-Project-8d5f20f6d9548b06e3ef2701baef4fb132474120.tar.gz Common-Interface-Project-8d5f20f6d9548b06e3ef2701baef4fb132474120.tar.bz2 Common-Interface-Project-8d5f20f6d9548b06e3ef2701baef4fb132474120.zip |
add duplicate check
-rw-r--r-- | blocks/eda-frontend/src/components/SchematicEditor/SideComp.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/blocks/eda-frontend/src/components/SchematicEditor/SideComp.js b/blocks/eda-frontend/src/components/SchematicEditor/SideComp.js index bb946298..b7847709 100644 --- a/blocks/eda-frontend/src/components/SchematicEditor/SideComp.js +++ b/blocks/eda-frontend/src/components/SchematicEditor/SideComp.js @@ -1,4 +1,4 @@ -import React, { useEffect } from 'react' +import React, { useEffect, useRef } from 'react' import PropTypes from 'prop-types' import { List, ListItemText, Tooltip, Popover } from '@material-ui/core' import { makeStyles } from '@material-ui/core/styles' @@ -18,6 +18,7 @@ const useStyles = makeStyles((theme) => ({ export default function SideComp ({ component }) { const classes = useStyles() const imageRef = React.createRef() + const isLoaded = useRef(false) const [anchorEl, setAnchorEl] = React.useState(null) @@ -32,6 +33,10 @@ export default function SideComp ({ component }) { const id = open ? 'simple-popover' : undefined useEffect(() => { + if (isLoaded.current) { + return + } + isLoaded.current = true // Function call to make components draggable AddComponent(component, imageRef.current) }, [imageRef, component]) |