refactor(wrapnode): only add resize oberver once
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user