diff --git a/src/components/UserSelection/index.tsx b/src/components/UserSelection/index.tsx index 38425666..4cb0238a 100644 --- a/src/components/UserSelection/index.tsx +++ b/src/components/UserSelection/index.tsx @@ -2,7 +2,7 @@ * The user selection rectangle gets displayed when a user drags the mouse while pressing shift */ -import React, { memo, useEffect } from 'react'; +import React, { memo } from 'react'; import { useStoreActions, useStoreState } from '../../store/hooks'; import { XYPosition } from '../../types'; @@ -53,12 +53,6 @@ export default memo(({ selectionKeyPressed }: UserSelectionProps) => { const unsetUserSelection = useStoreActions((actions) => actions.unsetUserSelection); const renderUserSelectionPane = selectionActive || selectionKeyPressed; - useEffect(() => { - if (!selectionKeyPressed) { - unsetUserSelection(); - } - }, [selectionKeyPressed]); - if (!elementsSelectable || !renderUserSelectionPane) { return null; } diff --git a/src/utils/graph.ts b/src/utils/graph.ts index d31c00cb..a1dfdfab 100644 --- a/src/utils/graph.ts +++ b/src/utils/graph.ts @@ -157,7 +157,7 @@ export const getBoundsofRects = (rect1: Rect, rect2: Rect): Rect => export const getRectOfNodes = (nodes: Node[]): Rect => { const box = nodes.reduce( - (currBox, { __rf: { position, width, height } }) => + (currBox, { __rf: { position, width, height } = {} }) => getBoundsOfBoxes(currBox, rectToBox({ ...position, width, height })), { x: Infinity, y: Infinity, x2: -Infinity, y2: -Infinity } );