refactor(store): use getNodes function

This commit is contained in:
moklick
2022-12-08 18:13:35 +01:00
parent 7c51a61f10
commit c51ae89eeb
18 changed files with 61 additions and 58 deletions
@@ -27,7 +27,7 @@ const selector = (s: ReactFlowState) => ({
});
const bboxSelector = (s: ReactFlowState) => {
const selectedNodes = Array.from(s.nodeInternals.values()).filter((n) => n.selected);
const selectedNodes = s.getNodes().filter((n) => n.selected);
return getRectOfNodes(selectedNodes, s.nodeOrigin);
};
@@ -55,7 +55,10 @@ function NodesSelection({ onSelectionContextMenu, noPanClassName, disableKeyboar
const onContextMenu = onSelectionContextMenu
? (event: MouseEvent) => {
const selectedNodes = Array.from(store.getState().nodeInternals.values()).filter((n) => n.selected);
const selectedNodes = store
.getState()
.getNodes()
.filter((n) => n.selected);
onSelectionContextMenu(event, selectedNodes);
}
: undefined;