refactor(wrapnode): only add resize oberver once

This commit is contained in:
moklick
2019-10-25 14:25:09 +02:00
parent 36ad89346d
commit 4986ba7fa1
+1 -2
View File
@@ -141,7 +141,6 @@ export default (NodeComponent: ComponentType<NodeComponentProps>) => {
const nodeElement = useRef<HTMLDivElement>(null); const nodeElement = useRef<HTMLDivElement>(null);
const [offset, setOffset] = useState({ x: 0, y: 0 }); const [offset, setOffset] = useState({ x: 0, y: 0 });
const [isDragging, setDragging] = useState(false); const [isDragging, setDragging] = useState(false);
const position = { x: xPos, y: yPos }; const position = { x: xPos, y: yPos };
const nodeClasses = cx('react-flow__node', { selected }); const nodeClasses = cx('react-flow__node', { selected });
const nodeStyle = { const nodeStyle = {
@@ -184,7 +183,7 @@ export default (NodeComponent: ComponentType<NodeComponentProps>) => {
} }
return; return;
}, [nodeElement.current]); }, []);
return ( return (
<DraggableCore <DraggableCore