Merge branch 'main' into feat/use-handle-connection

This commit is contained in:
peterkogo
2024-10-14 11:41:56 +02:00
8 changed files with 27 additions and 8 deletions
+6
View File
@@ -1,5 +1,11 @@
# @xyflow/react
## 12.3.2
### Patch Changes
- [#4722](https://github.com/xyflow/xyflow/pull/4722) [`e816bb69`](https://github.com/xyflow/xyflow/commit/e816bb6953486e37dd39d93252aa9b94fe5d4ec1) Thanks [@moklick](https://github.com/moklick)! - Fix internal behaviour that mutated user nodes which led to an issue with Redux and immer
## 12.3.1
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@xyflow/react",
"version": "12.3.1",
"version": "12.3.2",
"description": "React Flow - A highly customizable React library for building node-based editors and interactive flow charts.",
"keywords": [
"react",
+8 -3
View File
@@ -238,12 +238,17 @@ const createStore = ({
triggerNodeChanges(getSelectionChanges(nodeLookup, new Set(), true));
},
unselectNodesAndEdges: ({ nodes, edges }: UnselectNodesAndEdgesParams = {}) => {
const { edges: storeEdges, nodes: storeNodes, triggerNodeChanges, triggerEdgeChanges } = get();
const { edges: storeEdges, nodes: storeNodes, nodeLookup, triggerNodeChanges, triggerEdgeChanges } = get();
const nodesToUnselect = nodes ? nodes : storeNodes;
const edgesToUnselect = edges ? edges : storeEdges;
const nodeChanges = nodesToUnselect.map((n) => {
n.selected = false;
const internalNode = nodeLookup.get(n.id);
if (internalNode) {
// we need to unselect the internal node that was selected previously before we
// send the change to the user to prevent it to be selected while dragging the new node
internalNode.selected = false;
}
return createSelectionChange(n.id, false);
});
const edgeChanges = edgesToUnselect.map((edge) => createSelectionChange(edge.id, false));